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.
-
#amount ⇒ Object
Transaction amount for new calculation.
-
#amount_currency ⇒ Object
An currency of the transaction amount.
-
#amount_includes_network_fee ⇒ Object
Whether the amount includes network fee.
-
#amount_includes_processing_fee ⇒ Object
Whether the amount includes processing fee.
- #beneficiary ⇒ Object
-
#charged_amount ⇒ Object
The exact amount to debit from your account in ‘charged_currency`.
-
#charged_amount_to_send ⇒ Object
The exact transaction amount to send in ‘charged_currency`.
-
#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
The exact transaction amount to send in ‘received_currency`.
-
#received_currency ⇒ Object
Cryptocurrency type.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#travel_rule_compliant ⇒ Object
Is ‘false` if omitted.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CoinWithdrawalParams
Initializes the object
66 67 68 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 66 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::CoinWithdrawalParams
Builds the object from hash
59 60 61 62 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 59 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
71 72 73 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 71 def address @attributes[:address] end |
#amount ⇒ Object
Transaction amount for new calculation
134 135 136 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 134 def amount @attributes[:amount] end |
#amount_currency ⇒ Object
An currency of the transaction amount
139 140 141 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 139 def amount_currency @attributes[:amount_currency] end |
#amount_includes_network_fee ⇒ Object
Whether the amount includes network fee
149 150 151 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 149 def amount_includes_network_fee @attributes[:amount_includes_network_fee] end |
#amount_includes_processing_fee ⇒ Object
Whether the amount includes processing fee
144 145 146 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 144 def amount_includes_processing_fee @attributes[:amount_includes_processing_fee] end |
#beneficiary ⇒ Object
129 130 131 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 129 def beneficiary @attributes[:beneficiary] end |
#charged_amount ⇒ Object
The exact amount to debit from your account in ‘charged_currency`. All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it.
91 92 93 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 91 def charged_amount @attributes[:charged_amount] end |
#charged_amount_to_send ⇒ Object
The exact transaction amount to send in ‘charged_currency`. All applicable fees will be added on top of this amount and debited from your account.
96 97 98 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 96 def charged_amount_to_send @attributes[:charged_amount_to_send] end |
#charged_currency ⇒ Object
An account currency to send a transaction from
76 77 78 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 76 def charged_currency @attributes[:charged_currency] end |
#custom_id ⇒ Object
The payment reference ID in your system
106 107 108 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 106 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The internal ID of your customer that the wihdrawal relates to
111 112 113 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 111 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
120 121 122 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 120 def force_commit @attributes[:force_commit] end |
#inspect ⇒ Object
189 190 191 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 189 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?
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 155 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 beneficiary&.invalid_properties&.each do |prop| properties.push("invalid value for \"beneficiary\": #{prop}") end properties end |
#network ⇒ Object
Cryptocurrency network
86 87 88 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 86 def network @attributes[:network] end |
#network_fee_level ⇒ Object
115 116 117 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 115 def network_fee_level @attributes[:network_fee_level] end |
#received_amount ⇒ Object
The exact transaction amount to send in ‘received_currency`. All applicable fees will be added on top of this amount and debited from your account.
101 102 103 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 101 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Cryptocurrency type
81 82 83 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 81 def received_currency @attributes[:received_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
185 186 187 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 185 def to_hash ENCODER.to_hash(@attributes) end |
#travel_rule_compliant ⇒ Object
Is ‘false` if omitted. Set `true` to turn on beneficiary data validations
125 126 127 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 125 def travel_rule_compliant @attributes[:travel_rule_compliant] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
179 180 181 |
# File 'lib/cryptopay/models/coin_withdrawal_params.rb', line 179 def valid? invalid_properties.empty? end |