Class: Cryptopay::ChannelPayment
- Inherits:
-
Object
- Object
- Cryptopay::ChannelPayment
- Defined in:
- lib/cryptopay/models/channel_payment.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::ChannelPayment
Builds the object from hash.
Instance Method Summary collapse
-
#address ⇒ Object
Channel cryptocurrency address.
-
#channel_id ⇒ Object
Channel ID.
- #coin_withdrawal_id ⇒ Object
-
#created_at ⇒ Object
Channel payment creation date and time.
-
#custom_id ⇒ Object
Channel payment custom_id value inherited from its parent channel.
-
#customer_id ⇒ Object
The reference ID of your customer.
- #exchange ⇒ Object
-
#fee ⇒ Object
Processing fee.
-
#fee_currency ⇒ Object
Processing fee currency.
-
#id ⇒ Object
Channel payment ID.
-
#initialize(attributes = {}) ⇒ ChannelPayment
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#network ⇒ Object
Cryptocurrency network.
-
#paid_amount ⇒ Object
Cryptocurrency transaction amount that was received.
-
#paid_currency ⇒ Object
Cryptocurrency type.
-
#received_amount ⇒ Object
Amount credited to your Cryptopay account.
-
#received_currency ⇒ Object
Account currency.
- #refund_address ⇒ Object
- #risk ⇒ Object
- #status ⇒ Object
- #status_context ⇒ 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 = {}) ⇒ ChannelPayment
Initializes the object
74 75 76 |
# File 'lib/cryptopay/models/channel_payment.rb', line 74 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::ChannelPayment
Builds the object from hash
67 68 69 70 |
# File 'lib/cryptopay/models/channel_payment.rb', line 67 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#address ⇒ Object
Channel cryptocurrency address
158 159 160 |
# File 'lib/cryptopay/models/channel_payment.rb', line 158 def address @attributes[:address] end |
#channel_id ⇒ Object
Channel ID
84 85 86 |
# File 'lib/cryptopay/models/channel_payment.rb', line 84 def channel_id @attributes[:channel_id] end |
#coin_withdrawal_id ⇒ Object
143 144 145 |
# File 'lib/cryptopay/models/channel_payment.rb', line 143 def coin_withdrawal_id @attributes[:coin_withdrawal_id] end |
#created_at ⇒ Object
Channel payment creation date and time
168 169 170 |
# File 'lib/cryptopay/models/channel_payment.rb', line 168 def created_at @attributes[:created_at] end |
#custom_id ⇒ Object
Channel payment custom_id value inherited from its parent channel
148 149 150 |
# File 'lib/cryptopay/models/channel_payment.rb', line 148 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The reference ID of your customer
153 154 155 |
# File 'lib/cryptopay/models/channel_payment.rb', line 153 def customer_id @attributes[:customer_id] end |
#exchange ⇒ Object
123 124 125 |
# File 'lib/cryptopay/models/channel_payment.rb', line 123 def exchange @attributes[:exchange] end |
#fee ⇒ Object
Processing fee
109 110 111 |
# File 'lib/cryptopay/models/channel_payment.rb', line 109 def fee @attributes[:fee] end |
#fee_currency ⇒ Object
Processing fee currency
114 115 116 |
# File 'lib/cryptopay/models/channel_payment.rb', line 114 def fee_currency @attributes[:fee_currency] end |
#id ⇒ Object
Channel payment ID
79 80 81 |
# File 'lib/cryptopay/models/channel_payment.rb', line 79 def id @attributes[:id] end |
#inspect ⇒ Object
232 233 234 |
# File 'lib/cryptopay/models/channel_payment.rb', line 232 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?
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 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/cryptopay/models/channel_payment.rb', line 174 def invalid_properties properties = [] properties.push('invalid value for "id", id cannot be nil.') if id.nil? properties.push('invalid value for "channel_id", channel_id cannot be nil.') if channel_id.nil? properties.push('invalid value for "paid_amount", paid_amount cannot be nil.') if paid_amount.nil? properties.push('invalid value for "paid_currency", paid_currency cannot be nil.') if paid_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 "fee", fee cannot be nil.') if fee.nil? properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil? properties.push('invalid value for "txid", txid cannot be nil.') if txid.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 "status", status cannot be nil.') if status.nil? if !status.nil? && !%w[pending on_hold completed refunded cancelled].include?(status) properties.push('invalid value for status, must be one of "pending", "on_hold", "completed", "refunded", "cancelled"') end if !status_context.nil? && !%w[illicit_resource channel_disabled].include?(status_context) properties.push('invalid value for status_context, must be one of "illicit_resource", "channel_disabled"') end properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil? properties end |
#network ⇒ Object
Cryptocurrency network
163 164 165 |
# File 'lib/cryptopay/models/channel_payment.rb', line 163 def network @attributes[:network] end |
#paid_amount ⇒ Object
Cryptocurrency transaction amount that was received
89 90 91 |
# File 'lib/cryptopay/models/channel_payment.rb', line 89 def paid_amount @attributes[:paid_amount] end |
#paid_currency ⇒ Object
Cryptocurrency type
94 95 96 |
# File 'lib/cryptopay/models/channel_payment.rb', line 94 def paid_currency @attributes[:paid_currency] end |
#received_amount ⇒ Object
Amount credited to your Cryptopay account
99 100 101 |
# File 'lib/cryptopay/models/channel_payment.rb', line 99 def received_amount @attributes[:received_amount] end |
#received_currency ⇒ Object
Account currency
104 105 106 |
# File 'lib/cryptopay/models/channel_payment.rb', line 104 def received_currency @attributes[:received_currency] end |
#refund_address ⇒ Object
139 140 141 |
# File 'lib/cryptopay/models/channel_payment.rb', line 139 def refund_address @attributes[:refund_address] end |
#risk ⇒ Object
127 128 129 |
# File 'lib/cryptopay/models/channel_payment.rb', line 127 def risk @attributes[:risk] end |
#status ⇒ Object
131 132 133 |
# File 'lib/cryptopay/models/channel_payment.rb', line 131 def status @attributes[:status] end |
#status_context ⇒ Object
135 136 137 |
# File 'lib/cryptopay/models/channel_payment.rb', line 135 def status_context @attributes[:status_context] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
228 229 230 |
# File 'lib/cryptopay/models/channel_payment.rb', line 228 def to_hash ENCODER.to_hash(@attributes) end |
#txid ⇒ Object
Cryptocurrency transaction ID on the blockchain
119 120 121 |
# File 'lib/cryptopay/models/channel_payment.rb', line 119 def txid @attributes[:txid] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
222 223 224 |
# File 'lib/cryptopay/models/channel_payment.rb', line 222 def valid? invalid_properties.empty? end |