Class: Cryptopay::CoinWithdrawalParams
- Inherits:
-
Object
- Object
- Cryptopay::CoinWithdrawalParams
- Defined in:
- lib/cryptopay/models/coin_withdrawal_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::CoinWithdrawalParams
Builds the object from hash.
Instance Method Summary collapse
-
#address ⇒ Object
A recipient’s cryptocurrency wallet address.
-
#charged_amount ⇒ Object
All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it.
-
#charged_amount_to_send ⇒ Object
An exact transaction amount to send.
-
#charged_currency ⇒ Object
An account currency to send a transaction from.
-
#custom_id ⇒ Object
The payment reference ID in your system.
-
#customer_id ⇒ Object
The internal ID of your customer that the wihdrawal relates to.
-
#force_commit ⇒ Object
Is ‘false` if omitted.
-
#initialize(attributes = {}) ⇒ CoinWithdrawalParams
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#network ⇒ Object
Cryptocurrency network.
- #network_fee_level ⇒ Object
-
#received_amount ⇒ Object
An exact transaction amount to send.
-
#received_currency ⇒ Object
Cryptocurrency type.
-
#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 = {}) ⇒ CoinWithdrawalParams
Initializes the object
54 55 56 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 54 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::CoinWithdrawalParams
Builds the object from hash
47 48 49 50 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 47 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#address ⇒ Object
A recipient’s cryptocurrency wallet address
59 60 61 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 59 def address @attributes[:address] end |
#charged_amount ⇒ Object
All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it
79 80 81 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 79 def charged_amount @attributes[:charged_amount] end |
#charged_amount_to_send ⇒ Object
An exact transaction amount to send. All applicable fees will be added on top of this amount and debited from your account
84 85 86 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 84 def charged_amount_to_send @attributes[:charged_amount_to_send] end |
#charged_currency ⇒ Object
An account currency to send a transaction from
64 65 66 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 64 def charged_currency @attributes[:charged_currency] end |
#custom_id ⇒ Object
The payment reference ID in your system
94 95 96 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 94 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The internal ID of your customer that the wihdrawal relates to
99 100 101 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 99 def customer_id @attributes[:customer_id] end |
#force_commit ⇒ Object
Is ‘false` if omitted. Set `true` to turn off two-step withdrawal. Set `false` for two-step withdrawal and commit it within 30 seconds
108 109 110 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 108 def force_commit @attributes[:force_commit] end |
#inspect ⇒ Object
144 145 146 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 144 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?
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 114 def invalid_properties properties = [] properties.push('invalid value for "address", address cannot be nil.') if address.nil? 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 if !network_fee_level.nil? && !%w[fast average slow].include?(network_fee_level) properties.push('invalid value for network_fee_level, must be one of "fast", "average", "slow"') end properties end |
#network ⇒ Object
Cryptocurrency network
74 75 76 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 74 def network @attributes[:network] end |
#network_fee_level ⇒ Object
103 104 105 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 103 def network_fee_level @attributes[:network_fee_level] end |
#received_amount ⇒ Object
An exact transaction amount to send. All applicable fees will be added on top of this amount and debited from your account. Use this parameter if you want to send a transaction from cryptocurrency accounts only
89 90 91 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 89 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Cryptocurrency type
69 70 71 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 69 def received_currency @attributes[:received_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
140 141 142 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 140 def to_hash ENCODER.to_hash(@attributes) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
134 135 136 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 134 def valid? invalid_properties.empty? end |