Class: Bitodeme::Resource::Invoice
- Defined in:
- lib/bitodeme/resources/invoice.rb
Overview
Invoice resource
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Account identifier.
-
#address ⇒ Object
readonly
Fund address.
-
#amount ⇒ Object
readonly
Amount.
-
#cancel_return_url ⇒ Object
readonly
Cancellation return url.
-
#created_at ⇒ Object
readonly
Created at in milliseconds.
-
#currency_code ⇒ Object
readonly
Currency code.
-
#current_status ⇒ Object
readonly
Current status.
-
#deleted_at ⇒ Object
readonly
Deleted at in milliseconds.
-
#description ⇒ Object
readonly
Description.
-
#external_id ⇒ Object
readonly
External unique identifier.
-
#id ⇒ Object
readonly
Unique identifier.
-
#name ⇒ Object
readonly
Name/title.
-
#notify_url ⇒ Object
readonly
Notify url.
-
#original_amount ⇒ Object
readonly
Original amount.
-
#original_currency_code ⇒ Object
readonly
Original currency code.
-
#purchasable ⇒ Object
readonly
Is it purchasable.
-
#return_url ⇒ Object
readonly
Successful payment return url.
-
#updated_at ⇒ Object
readonly
Updated at in milliseconds.
Class Method Summary collapse
-
.build(params) ⇒ Object
Build an invoice.
-
.create(invoice) ⇒ Object
Craete a new invoice.
-
.find(id) ⇒ Object
Find an invoice.
Methods inherited from Base
Instance Attribute Details
#account_id ⇒ Object (readonly)
Account identifier
8 9 10 |
# File 'lib/bitodeme/resources/invoice.rb', line 8 def account_id @account_id end |
#address ⇒ Object (readonly)
Fund address
11 12 13 |
# File 'lib/bitodeme/resources/invoice.rb', line 11 def address @address end |
#amount ⇒ Object (readonly)
Amount
14 15 16 |
# File 'lib/bitodeme/resources/invoice.rb', line 14 def amount @amount end |
#cancel_return_url ⇒ Object (readonly)
Cancellation return url
17 18 19 |
# File 'lib/bitodeme/resources/invoice.rb', line 17 def cancel_return_url @cancel_return_url end |
#created_at ⇒ Object (readonly)
Created at in milliseconds
20 21 22 |
# File 'lib/bitodeme/resources/invoice.rb', line 20 def created_at @created_at end |
#currency_code ⇒ Object (readonly)
Currency code
23 24 25 |
# File 'lib/bitodeme/resources/invoice.rb', line 23 def currency_code @currency_code end |
#current_status ⇒ Object (readonly)
Current status
26 27 28 |
# File 'lib/bitodeme/resources/invoice.rb', line 26 def current_status @current_status end |
#deleted_at ⇒ Object (readonly)
Deleted at in milliseconds
29 30 31 |
# File 'lib/bitodeme/resources/invoice.rb', line 29 def deleted_at @deleted_at end |
#description ⇒ Object (readonly)
Description
32 33 34 |
# File 'lib/bitodeme/resources/invoice.rb', line 32 def description @description end |
#external_id ⇒ Object (readonly)
External unique identifier
35 36 37 |
# File 'lib/bitodeme/resources/invoice.rb', line 35 def external_id @external_id end |
#id ⇒ Object (readonly)
Unique identifier
38 39 40 |
# File 'lib/bitodeme/resources/invoice.rb', line 38 def id @id end |
#name ⇒ Object (readonly)
Name/title
41 42 43 |
# File 'lib/bitodeme/resources/invoice.rb', line 41 def name @name end |
#notify_url ⇒ Object (readonly)
Notify url
44 45 46 |
# File 'lib/bitodeme/resources/invoice.rb', line 44 def notify_url @notify_url end |
#original_amount ⇒ Object (readonly)
Original amount
47 48 49 |
# File 'lib/bitodeme/resources/invoice.rb', line 47 def original_amount @original_amount end |
#original_currency_code ⇒ Object (readonly)
Original currency code
50 51 52 |
# File 'lib/bitodeme/resources/invoice.rb', line 50 def original_currency_code @original_currency_code end |
#purchasable ⇒ Object (readonly)
Is it purchasable
53 54 55 |
# File 'lib/bitodeme/resources/invoice.rb', line 53 def purchasable @purchasable end |
#return_url ⇒ Object (readonly)
Successful payment return url
56 57 58 |
# File 'lib/bitodeme/resources/invoice.rb', line 56 def return_url @return_url end |
#updated_at ⇒ Object (readonly)
Updated at in milliseconds
59 60 61 |
# File 'lib/bitodeme/resources/invoice.rb', line 59 def updated_at @updated_at end |
Class Method Details
.build(params) ⇒ Object
Build an invoice
Example:
>> invoice =
>> Bitodeme::Resource::Invoice.build(
>> name: 'Virtual game gold',
>> description: 'Buy a game gold',
>> original_amount: 16.7,
>> original_currency_code: 'USD',
>> external_id: 'SomeUniqId',
>> purchasable: {}
>> )
Arguments:
params: (Hash)
77 78 79 |
# File 'lib/bitodeme/resources/invoice.rb', line 77 def build(params) new(params).send(:validate) end |
.create(invoice) ⇒ Object
Craete a new invoice
Example:
>> invoice =
>> Bitodeme.build_invoice(
>> name: 'Virtual game gold',
>> description: 'Buy a game gold',
>> original_amount: 16.7,
>> original_currency_code: 'USD',
>> external_id: 'SomeUniqId',
>> purchasable: {}
>> )
>> invoice = Bitodeme.create_invoice(invoice)
Arguments:
invoice: (Bitodeme::Resource::Invoice)
106 107 108 109 |
# File 'lib/bitodeme/resources/invoice.rb', line 106 def create(invoice) raise_for('invoice', invoice) unless invoice.is_a?(Invoice) _create('invoices', 'invoice', invoice: invoice.to_h) end |
.find(id) ⇒ Object
Find an invoice
Arguments:
id: (UUID)
85 86 87 |
# File 'lib/bitodeme/resources/invoice.rb', line 85 def find(id) _find('invoices', 'invoice', id) end |