Class: Cryptopay::CoinWithdrawal
- Inherits:
-
Object
- Object
- Cryptopay::CoinWithdrawal
- Defined in:
- lib/cryptopay/models/coin_withdrawal.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::CoinWithdrawal
Builds the object from hash.
Instance Method Summary collapse
-
#address ⇒ Object
Recipient’s cryptocurrency wallet address.
-
#charged_amount ⇒ Object
Payment amount.
-
#charged_currency ⇒ Object
Account currency the payment has been sent from.
-
#created_at ⇒ Object
Coin withdrawal creation date and time.
-
#custom_id ⇒ Object
Payment reference ID in your system.
-
#customer_id ⇒ Object
The reference ID of your customer.
- #exchange ⇒ Object
- #fee ⇒ Object
- #fee_currency ⇒ Object
-
#id ⇒ Object
Coin withdrawal ID.
-
#initialize(attributes = {}) ⇒ CoinWithdrawal
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#network ⇒ Object
Cryptocurrency network.
-
#network_fee ⇒ Object
Network fee amount.
- #network_fee_level ⇒ Object
-
#received_amount ⇒ Object
Cryptocurrency transaction amount.
-
#received_currency ⇒ Object
Cryptocurrency type.
- #risk ⇒ Object
- #status ⇒ Object
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#txid ⇒ Object
Cryptocurrency transaction ID on the blockchain.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CoinWithdrawal
Initializes the object
69 70 71 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 69 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::CoinWithdrawal
Builds the object from hash
62 63 64 65 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 62 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#address ⇒ Object
Recipient’s cryptocurrency wallet address
89 90 91 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 89 def address @attributes[:address] end |
#charged_amount ⇒ Object
Payment amount. Amount charged from your account
108 109 110 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 108 def charged_amount @attributes[:charged_amount] end |
#charged_currency ⇒ Object
Account currency the payment has been sent from
113 114 115 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 113 def charged_currency @attributes[:charged_currency] end |
#created_at ⇒ Object
Coin withdrawal creation date and time
153 154 155 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 153 def created_at @attributes[:created_at] end |
#custom_id ⇒ Object
Payment reference ID in your system
79 80 81 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 79 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The reference ID of your customer
84 85 86 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 84 def customer_id @attributes[:customer_id] end |
#exchange ⇒ Object
144 145 146 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 144 def exchange @attributes[:exchange] end |
#fee ⇒ Object
136 137 138 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 136 def fee @attributes[:fee] end |
#fee_currency ⇒ Object
140 141 142 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 140 def fee_currency @attributes[:fee_currency] end |
#id ⇒ Object
Coin withdrawal ID
74 75 76 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 74 def id @attributes[:id] end |
#inspect ⇒ Object
221 222 223 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 221 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?
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 159 def invalid_properties properties = [] properties.push('invalid value for "address", address cannot be nil.') if address.nil? properties.push('invalid value for "network", network cannot be nil.') if network.nil? properties.push('invalid value for "status", status cannot be nil.') if status.nil? if !status.nil? && !%w[new pending on_hold processing sent completed failed cancelled].include?(status) properties.push('invalid value for status, must be one of "new", "pending", "on_hold", "processing", "sent", "completed", "failed", "cancelled"') end 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 properties.push('invalid value for "network_fee", network_fee cannot be nil.') if network_fee.nil? if network_fee_level.nil? properties.push('invalid value for "network_fee_level", network_fee_level 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.push('invalid value for "fee", fee cannot be nil.') if fee.nil? properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil? exchange&.invalid_properties&.each do |prop| properties.push("invalid value for \"exchange\": #{prop}") 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 |
#network ⇒ Object
Cryptocurrency network
94 95 96 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 94 def network @attributes[:network] end |
#network_fee ⇒ Object
Network fee amount
128 129 130 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 128 def network_fee @attributes[:network_fee] end |
#network_fee_level ⇒ Object
132 133 134 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 132 def network_fee_level @attributes[:network_fee_level] end |
#received_amount ⇒ Object
Cryptocurrency transaction amount. Exact amount received by a recipient
118 119 120 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 118 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Cryptocurrency type
123 124 125 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 123 def received_currency @attributes[:received_currency] end |
#risk ⇒ Object
148 149 150 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 148 def risk @attributes[:risk] end |
#status ⇒ Object
103 104 105 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 103 def status @attributes[:status] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
217 218 219 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 217 def to_hash ENCODER.to_hash(@attributes) end |
#txid ⇒ Object
Cryptocurrency transaction ID on the blockchain
99 100 101 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 99 def txid @attributes[:txid] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
211 212 213 |
# File 'lib/cryptopay/models/coin_withdrawal.rb', line 211 def valid? invalid_properties.empty? end |