Class: Bitodeme::Resource::Withdrawal
- Defined in:
- lib/bitodeme/resources/withdrawal.rb
Overview
Withdrawal resource
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Address.
-
#amount ⇒ Object
readonly
Amount.
-
#fund_id ⇒ Object
readonly
Fund identifier.
-
#id ⇒ Object
readonly
Unique identifier.
-
#otp_value ⇒ Object
readonly
One time password value gathered from Google Authenticator.
Class Method Summary collapse
-
.build(params) ⇒ Object
Build a withdrawal object.
-
.create(withdrawal) ⇒ Object
Craete a new withdrawal(send money).
Methods inherited from Base
Instance Attribute Details
#address ⇒ Object (readonly)
Address
8 9 10 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 8 def address @address end |
#amount ⇒ Object (readonly)
Amount
11 12 13 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 11 def amount @amount end |
#fund_id ⇒ Object (readonly)
Fund identifier
14 15 16 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 14 def fund_id @fund_id end |
#id ⇒ Object (readonly)
Unique identifier
17 18 19 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 17 def id @id end |
#otp_value ⇒ Object (readonly)
One time password value gathered from Google Authenticator
20 21 22 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 20 def otp_value @otp_value end |
Class Method Details
.build(params) ⇒ Object
Build a withdrawal object
Example:
>> fund_id = '12b241a7-941e-43a8-878e-a467809e988e'
>> withdrawal =
>> Bitodeme::Resource::Withdrawal.build(
>> amount: 0.0013,
>> address: 'morg4YKzAESEktS7H74dtaavFjuhNUi8zq',
>> fund_id: fund_id,
>> otp_value: "123456" # otp value from Google Authenticator
>> )
Arguments:
params: (Hash)
37 38 39 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 37 def build(params) new(params).send(:validate) end |
.create(withdrawal) ⇒ Object
Craete a new withdrawal(send money)
Example:
>> fund_id = '12b241a7-941e-43a8-878e-a467809e988e'
>> withdrawal =
>> Bitodeme::Resource::Withdrawal.build(
>> amount: 0.0013,
>> address: 'morg4YKzAESEktS7H74dtaavFjuhNUi8zq',
>> fund_id: fund_id,
>> otp_value: "123456" # otp value from Google Authenticator
>> )
>> Bitodeme::Resource::Withdrawal.create(withdrawal)
Arguments:
withdrawal: (Bitodeme::Resource::Withdrawal)
57 58 59 60 61 |
# File 'lib/bitodeme/resources/withdrawal.rb', line 57 def create(withdrawal) raise_for('withdrawal', withdrawal) unless withdrawal.is_a?(Withdrawal) data = { withdrawal: withdrawal.to_h } post('/api/v1/withdrawals', data).body end |