Class: Vertpig::Withdrawal

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/vertpig/withdrawal.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#extract_timestamp

Constructor Details

#initialize(attrs = {}) ⇒ Withdrawal

Returns a new instance of Withdrawal.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vertpig/withdrawal.rb', line 9

def initialize(attrs = {})
  @id = attrs['PaymentUuid']
  @currency = attrs['Currency']
  @quantity = attrs['Amount']
  @address = attrs['Address']
  @authorized = attrs['Authorized']
  @pending = attrs['PendingPayment']
  @canceled = attrs['Canceled']
  @invalid_address = attrs['Canceled']
  @transaction_cost = attrs['TxCost']
  @transaction_id = attrs['TxId']
  @executed_at = extract_timestamp(attrs['Opened'])
  @raw = attrs
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def address
  @address
end

#authorizedObject (readonly)

Returns the value of attribute authorized.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def authorized
  @authorized
end

#canceledObject (readonly)

Returns the value of attribute canceled.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def canceled
  @canceled
end

#currencyObject (readonly)

Returns the value of attribute currency.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def currency
  @currency
end

#executed_atObject (readonly)

Returns the value of attribute executed_at.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def executed_at
  @executed_at
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def id
  @id
end

#invalid_addressObject (readonly)

Returns the value of attribute invalid_address.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def invalid_address
  @invalid_address
end

#pendingObject (readonly)

Returns the value of attribute pending.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def pending
  @pending
end

#quantityObject (readonly)

Returns the value of attribute quantity.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def quantity
  @quantity
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def raw
  @raw
end

#transaction_costObject (readonly)

Returns the value of attribute transaction_cost.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def transaction_cost
  @transaction_cost
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



5
6
7
# File 'lib/vertpig/withdrawal.rb', line 5

def transaction_id
  @transaction_id
end

Class Method Details

.allObject



24
25
26
# File 'lib/vertpig/withdrawal.rb', line 24

def self.all
  client.get('account/getwithdrawalhistory').map{|data| new(data) }
end

.single(currency, quantity, address) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/vertpig/withdrawal.rb', line 28

def self.single(currency, quantity, address)
  client.get('account/withdraw', {
    currency: currency,
    quantity: quantity,
    address: address
  })
end