Class: Cryptopay::ExchangeTransferParams
- Inherits:
-
Object
- Object
- Cryptopay::ExchangeTransferParams
- Defined in:
- lib/cryptopay/models/exchange_transfer_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::ExchangeTransferParams
Builds the object from hash.
Instance Method Summary collapse
-
#charged_amount ⇒ Object
Amount to be converted.
-
#charged_currency ⇒ Object
Account currency the funds to be converted from.
-
#custom_id ⇒ Object
Exchange transaction reference ID in your system.
-
#force_commit ⇒ Object
Is ‘false` if omitted.
-
#initialize(attributes = {}) ⇒ ExchangeTransferParams
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 to be 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 = {}) ⇒ ExchangeTransferParams
Initializes the object
43 44 45 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 43 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::ExchangeTransferParams
Builds the object from hash
36 37 38 39 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 36 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#charged_amount ⇒ Object
Amount to be converted
53 54 55 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 53 def charged_amount @attributes[:charged_amount] end |
#charged_currency ⇒ Object
Account currency the funds to be converted from
48 49 50 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 48 def charged_currency @attributes[:charged_currency] end |
#custom_id ⇒ Object
Exchange transaction reference ID in your system
68 69 70 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 68 def custom_id @attributes[:custom_id] end |
#force_commit ⇒ Object
Is ‘false` if omitted. Set `true` to turn off two-step exchange. Set `false` for two-step exchange and commit it within 30 seconds
73 74 75 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 73 def force_commit @attributes[:force_commit] end |
#inspect ⇒ Object
103 104 105 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 103 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?
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 79 def invalid_properties properties = [] properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil? if received_currency.nil? properties.push('invalid value for "received_currency", received_currency cannot be nil.') end properties end |
#received_amount ⇒ Object
Amount to be received upon exchange execution
63 64 65 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 63 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Account currency the funds to be converted to
58 59 60 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 58 def received_currency @attributes[:received_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
99 100 101 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 99 def to_hash ENCODER.to_hash(@attributes) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
93 94 95 |
# File 'lib/cryptopay/models/exchange_transfer_params.rb', line 93 def valid? invalid_properties.empty? end |