Class: Cryptopay::InvoiceParams
- Inherits:
-
Object
- Object
- Cryptopay::InvoiceParams
- Defined in:
- lib/cryptopay/models/invoice_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::InvoiceParams
Builds the object from hash.
Instance Method Summary collapse
-
#custom_id ⇒ Object
The payment reference ID in your system.
-
#customer_id ⇒ Object
The internal ID of your customer that the invoice relates to.
-
#description ⇒ Object
The invoice description.
-
#initialize(attributes = {}) ⇒ InvoiceParams
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#metadata ⇒ Object
Custom key-valued data.
-
#name ⇒ Object
The invoice name.
-
#network ⇒ Object
Cryptocurrency network.
-
#pay_currency ⇒ Object
The cryptocurrency that the invoice must be paid in.
-
#payer_email ⇒ Object
Email of payer.
-
#price_amount ⇒ Object
The invoice amount.
-
#price_currency ⇒ Object
The invoice amount currency.
-
#success_redirect_url ⇒ Object
The URL that the customer will be redirected to upon transaction confirmation.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
- #unsuccess_redirect_url ⇒ Object
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ InvoiceParams
Initializes the object
52 53 54 |
# File 'lib/cryptopay/models/invoice_params.rb', line 52 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::InvoiceParams
Builds the object from hash
45 46 47 48 |
# File 'lib/cryptopay/models/invoice_params.rb', line 45 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#custom_id ⇒ Object
The payment reference ID in your system
77 78 79 |
# File 'lib/cryptopay/models/invoice_params.rb', line 77 def custom_id @attributes[:custom_id] end |
#customer_id ⇒ Object
The internal ID of your customer that the invoice relates to. See Customers for more information
82 83 84 |
# File 'lib/cryptopay/models/invoice_params.rb', line 82 def customer_id @attributes[:customer_id] end |
#description ⇒ Object
The invoice description
92 93 94 |
# File 'lib/cryptopay/models/invoice_params.rb', line 92 def description @attributes[:description] end |
#inspect ⇒ Object
141 142 143 |
# File 'lib/cryptopay/models/invoice_params.rb', line 141 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?
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/cryptopay/models/invoice_params.rb', line 117 def invalid_properties properties = [] 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 "pay_currency", pay_currency cannot be nil.') if pay_currency.nil? properties end |
#metadata ⇒ Object
Custom key-valued data
97 98 99 |
# File 'lib/cryptopay/models/invoice_params.rb', line 97 def @attributes[:metadata] end |
#name ⇒ Object
The invoice name
87 88 89 |
# File 'lib/cryptopay/models/invoice_params.rb', line 87 def name @attributes[:name] end |
#network ⇒ Object
Cryptocurrency network
72 73 74 |
# File 'lib/cryptopay/models/invoice_params.rb', line 72 def network @attributes[:network] end |
#pay_currency ⇒ Object
The cryptocurrency that the invoice must be paid in
67 68 69 |
# File 'lib/cryptopay/models/invoice_params.rb', line 67 def pay_currency @attributes[:pay_currency] end |
#payer_email ⇒ Object
Email of payer
111 112 113 |
# File 'lib/cryptopay/models/invoice_params.rb', line 111 def payer_email @attributes[:payer_email] end |
#price_amount ⇒ Object
The invoice amount
57 58 59 |
# File 'lib/cryptopay/models/invoice_params.rb', line 57 def price_amount @attributes[:price_amount] end |
#price_currency ⇒ Object
The invoice amount currency
62 63 64 |
# File 'lib/cryptopay/models/invoice_params.rb', line 62 def price_currency @attributes[:price_currency] end |
#success_redirect_url ⇒ Object
The URL that the customer will be redirected to upon transaction confirmation
102 103 104 |
# File 'lib/cryptopay/models/invoice_params.rb', line 102 def success_redirect_url @attributes[:success_redirect_url] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
137 138 139 |
# File 'lib/cryptopay/models/invoice_params.rb', line 137 def to_hash ENCODER.to_hash(@attributes) end |
#unsuccess_redirect_url ⇒ Object
106 107 108 |
# File 'lib/cryptopay/models/invoice_params.rb', line 106 def unsuccess_redirect_url @attributes[:unsuccess_redirect_url] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
131 132 133 |
# File 'lib/cryptopay/models/invoice_params.rb', line 131 def valid? invalid_properties.empty? end |