class Cryptopay::Transaction

Constants

ENCODER

Public Class Methods

build_from_hash(data) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Cryptopay::Transaction] Returns the model itself

# File lib/cryptopay/models/transaction.rb, line 159
def self.build_from_hash(data)
  attributes = ENCODER.build_from_hash(data)
  new(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/cryptopay/models/transaction.rb, line 56
def initialize(attributes = {})
  @attributes = ENCODER.sanitize(attributes)
end

Public Instance Methods

amount() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 72
def amount
  @attributes[:amount]
end
balance() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 80
def balance
  @attributes[:balance]
end
created_at() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 116
def created_at
  @attributes[:created_at]
end
currency() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 76
def currency
  @attributes[:currency]
end
custom_id() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 64
def custom_id
  @attributes[:custom_id]
end
customer_id() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 68
def customer_id
  @attributes[:customer_id]
end
description() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 100
def description
  @attributes[:description]
end
fee() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 84
def fee
  @attributes[:fee]
end
fee_currency() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 88
def fee_currency
  @attributes[:fee_currency]
end
id() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 60
def id
  @attributes[:id]
end
inspect() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 170
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
end
invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/cryptopay/models/transaction.rb, line 122
def invalid_properties
  properties = []

  properties.push('invalid value for "id", id cannot be nil.') if id.nil?

  properties.push('invalid value for "amount", amount cannot be nil.') if amount.nil?

  properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil?

  properties.push('invalid value for "balance", balance cannot be nil.') if balance.nil?

  properties.push('invalid value for "reference_id", reference_id cannot be nil.') if reference_id.nil?

  properties.push('invalid value for "reference_type", reference_type cannot be nil.') if reference_type.nil?

  if !reference_type.nil? && !%w[BankDeposit BankWithdrawal ChannelPayment CoinDeposit CoinWithdrawal ExchangeTransfer Invoice InvoiceRefund ManualBalanceTransaction].include?(reference_type)
    properties.push('invalid value for reference_type, must be one of "BankDeposit", "BankWithdrawal", "ChannelPayment", "CoinDeposit", "CoinWithdrawal", "ExchangeTransfer", "Invoice", "InvoiceRefund", "ManualBalanceTransaction"')
  end

  risk&.invalid_properties&.each do |prop|
    properties.push("invalid value for \"risk\": #{prop}")
  end

  properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil?

  properties
end
reference_id() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 92
def reference_id
  @attributes[:reference_id]
end
reference_type() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 96
def reference_type
  @attributes[:reference_type]
end
risk() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 112
def risk
  @attributes[:risk]
end
status() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 104
def status
  @attributes[:status]
end
status_context() click to toggle source
# File lib/cryptopay/models/transaction.rb, line 108
def status_context
  @attributes[:status_context]
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/cryptopay/models/transaction.rb, line 166
def to_hash
  ENCODER.to_hash(@attributes)
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/cryptopay/models/transaction.rb, line 152
def valid?
  invalid_properties.empty?
end