Class: Cryptopay::ExchangeTransfer
- Inherits:
-
Object
- Object
- Cryptopay::ExchangeTransfer
- Defined in:
- lib/cryptopay/models/exchange_transfer.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::ExchangeTransfer
Builds the object from hash.
Instance Method Summary collapse
-
#charged_amount ⇒ Object
Amount converted.
-
#charged_currency ⇒ Object
Account currency the funds converted from.
-
#custom_id ⇒ Object
Exchange transaction reference ID in your system.
- #exchange ⇒ Object
-
#id ⇒ Object
Exchange transaction ID.
-
#initialize(attributes = {}) ⇒ ExchangeTransfer
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#received_amount ⇒ Object
Amount to be received upon exchange execution.
-
#received_currency ⇒ Object
Account currency the funds converted to.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ExchangeTransfer
Initializes the object
44 45 46 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 44 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::ExchangeTransfer
Builds the object from hash
37 38 39 40 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 37 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#charged_amount ⇒ Object
Amount converted
54 55 56 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 54 def charged_amount @attributes[:charged_amount] end |
#charged_currency ⇒ Object
Account currency the funds converted from
59 60 61 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 59 def charged_currency @attributes[:charged_currency] end |
#custom_id ⇒ Object
Exchange transaction reference ID in your system
74 75 76 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 74 def custom_id @attributes[:custom_id] end |
#exchange ⇒ Object
78 79 80 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 78 def exchange @attributes[:exchange] end |
#id ⇒ Object
Exchange transaction ID
49 50 51 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 49 def id @attributes[:id] end |
#inspect ⇒ Object
118 119 120 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 118 def inspect "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash) end |
#invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 84 def invalid_properties properties = [] properties.push('invalid value for "id", id cannot be nil.') if id.nil? properties.push('invalid value for "charged_amount", charged_amount cannot be nil.') if charged_amount.nil? properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil? properties.push('invalid value for "received_amount", received_amount cannot be nil.') if received_amount.nil? if received_currency.nil? properties.push('invalid value for "received_currency", received_currency cannot be nil.') end exchange&.invalid_properties&.each do |prop| properties.push("invalid value for \"exchange\": #{prop}") end properties end |
#received_amount ⇒ Object
Amount to be received upon exchange execution
64 65 66 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 64 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Account currency the funds converted to
69 70 71 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 69 def received_currency @attributes[:received_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
114 115 116 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 114 def to_hash ENCODER.to_hash(@attributes) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
108 109 110 |
# File 'lib/cryptopay/models/exchange_transfer.rb', line 108 def valid? invalid_properties.empty? end |