Class: Cryptopay::InvoiceRecalculation
- Inherits:
-
Object
- Object
- Cryptopay::InvoiceRecalculation
- Defined in:
- lib/cryptopay/models/invoice_recalculation.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::InvoiceRecalculation
Builds the object from hash.
Instance Method Summary collapse
-
#created_at ⇒ Object
Recalculation creation date and time.
- #exchange ⇒ Object
-
#fee ⇒ Object
Processing fee.
-
#fee_currency ⇒ Object
Processing fee currency.
-
#id ⇒ Object
Recalculation ID.
-
#initialize(attributes = {}) ⇒ InvoiceRecalculation
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#invoice_id ⇒ Object
Invoice ID.
-
#pay_amount ⇒ Object
Cryptocurrency amount received.
-
#pay_currency ⇒ Object
Cryptocurrency type.
-
#previous_exchange_rate ⇒ Object
Previous exchange rate.
-
#previous_pay_amount ⇒ Object
Previous amount to pay.
-
#previous_price_amount ⇒ Object
Previous invoice amount.
-
#price_amount ⇒ Object
New invoice amount.
-
#price_currency ⇒ Object
Invoice amount currency.
-
#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 = {}) ⇒ InvoiceRecalculation
Initializes the object
56 57 58 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 56 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::InvoiceRecalculation
Builds the object from hash
49 50 51 52 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 49 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#created_at ⇒ Object
Recalculation creation date and time
120 121 122 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 120 def created_at @attributes[:created_at] end |
#exchange ⇒ Object
115 116 117 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 115 def exchange @attributes[:exchange] end |
#fee ⇒ Object
Processing fee
91 92 93 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 91 def fee @attributes[:fee] end |
#fee_currency ⇒ Object
Processing fee currency
96 97 98 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 96 def fee_currency @attributes[:fee_currency] end |
#id ⇒ Object
Recalculation ID
61 62 63 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 61 def id @attributes[:id] end |
#inspect ⇒ Object
174 175 176 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 174 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?
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 126 def invalid_properties properties = [] properties.push('invalid value for "id", id cannot be nil.') if id.nil? properties.push('invalid value for "invoice_id", invoice_id cannot be nil.') if invoice_id.nil? properties.push('invalid value for "pay_amount", pay_amount cannot be nil.') if pay_amount.nil? properties.push('invalid value for "pay_currency", pay_currency cannot be nil.') if pay_currency.nil? properties.push('invalid value for "price_amount", price_amount cannot be nil.') if price_amount.nil? properties.push('invalid value for "price_currency", price_currency cannot be nil.') if price_currency.nil? 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? if previous_pay_amount.nil? properties.push('invalid value for "previous_pay_amount", previous_pay_amount cannot be nil.') end if previous_price_amount.nil? properties.push('invalid value for "previous_price_amount", previous_price_amount cannot be nil.') end exchange&.invalid_properties&.each do |prop| properties.push("invalid value for \"exchange\": #{prop}") end properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil? properties end |
#invoice_id ⇒ Object
Invoice ID
66 67 68 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 66 def invoice_id @attributes[:invoice_id] end |
#pay_amount ⇒ Object
Cryptocurrency amount received
71 72 73 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 71 def pay_amount @attributes[:pay_amount] end |
#pay_currency ⇒ Object
Cryptocurrency type
76 77 78 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 76 def pay_currency @attributes[:pay_currency] end |
#previous_exchange_rate ⇒ Object
Previous exchange rate
111 112 113 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 111 def previous_exchange_rate @attributes[:previous_exchange_rate] end |
#previous_pay_amount ⇒ Object
Previous amount to pay
101 102 103 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 101 def previous_pay_amount @attributes[:previous_pay_amount] end |
#previous_price_amount ⇒ Object
Previous invoice amount
106 107 108 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 106 def previous_price_amount @attributes[:previous_price_amount] end |
#price_amount ⇒ Object
New invoice amount
81 82 83 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 81 def price_amount @attributes[:price_amount] end |
#price_currency ⇒ Object
Invoice amount currency
86 87 88 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 86 def price_currency @attributes[:price_currency] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
170 171 172 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 170 def to_hash ENCODER.to_hash(@attributes) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
164 165 166 |
# File 'lib/cryptopay/models/invoice_recalculation.rb', line 164 def valid? invalid_properties.empty? end |