Class: Bitex::SpecieWithdrawal

Inherits:
Object
  • Object
show all
Defined in:
lib/bitex/specie_withdrawal.rb

Overview

A withdrawal of some specie from your bitex.la balance

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#created_atTime

Returns Time when this withdrawal was requested by you.

Returns:

  • (Time)

    Time when this withdrawal was requested by you.



10
11
12
# File 'lib/bitex/specie_withdrawal.rb', line 10

def created_at
  @created_at
end

#idInteger

Returns This SpecieWithdrawal’s unique ID.

Returns:

  • (Integer)

    This SpecieWithdrawal’s unique ID.



6
7
8
# File 'lib/bitex/specie_withdrawal.rb', line 6

def id
  @id
end

#kyc_profile_idInteger

Returns Kyc profile id for which this request was made.

Returns:

  • (Integer)

    Kyc profile id for which this request was made.



46
47
48
# File 'lib/bitex/specie_withdrawal.rb', line 46

def kyc_profile_id
  @kyc_profile_id
end

#labelString

Returns A custom label you gave to this address.

Returns:

  • (String)

    A custom label you gave to this address.



42
43
44
# File 'lib/bitex/specie_withdrawal.rb', line 42

def label
  @label
end

#quantityBigDecimal

Returns Quantity deposited.

Returns:

  • (BigDecimal)

    Quantity deposited



18
19
20
# File 'lib/bitex/specie_withdrawal.rb', line 18

def quantity
  @quantity
end

#reasonObject

Returns the reason for cancellation of this withdrawal, if any.

  • :not_cancelled

  • :insufficient_funds The instruction was received, but you didn’t have enough funds available

  • :destination_invalid The destination address was invalid.



34
35
36
# File 'lib/bitex/specie_withdrawal.rb', line 34

def reason
  @reason
end

#specieSymbol

Returns :btc.

Returns:

  • (Symbol)

    :btc



14
15
16
# File 'lib/bitex/specie_withdrawal.rb', line 14

def specie
  @specie
end

#statusObject

Returns the status of this withdrawal.

  • :received Our engine is checking if you have enough funds.

  • :pending your withdrawal was accepted and is being processed.

  • :done your withdrawal was processed and published to the network.

  • :cancelled your withdrawal could not be processed.



26
27
28
# File 'lib/bitex/specie_withdrawal.rb', line 26

def status
  @status
end

#to_addressString

Returns Address to wich you made this withdrawal.

Returns:

  • (String)

    Address to wich you made this withdrawal.



38
39
40
# File 'lib/bitex/specie_withdrawal.rb', line 38

def to_address
  @to_address
end

#transaction_idString

Returns Network transaction id, if available.

Returns:

  • (String)

    Network transaction id, if available.



50
51
52
# File 'lib/bitex/specie_withdrawal.rb', line 50

def transaction_id
  @transaction_id
end

Class Method Details

.all(specie) ⇒ Object



85
86
87
# File 'lib/bitex/specie_withdrawal.rb', line 85

def self.all(specie)
  Api.private(:get, "/private/#{specie}/withdrawals").map { |sw| from_json(sw) }
end

.create!(specie, address, amount, label, kyc_profile_id = nil) ⇒ Object

rubocop:enable Metrics/AbcSize



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/bitex/specie_withdrawal.rb', line 68

def self.create!(specie, address, amount, label, kyc_profile_id = nil)
  from_json(
    Api.private(
      :post,
      "/private/#{specie}/withdrawals",
      address: address,
      amount: amount,
      label: label,
      kyc_profile_id: kyc_profile_id
    )
  )
end

.find(specie, id) ⇒ Object



81
82
83
# File 'lib/bitex/specie_withdrawal.rb', line 81

def self.find(specie, id)
  from_json(Api.private(:get, "/private/#{specie}/withdrawals/#{id}"))
end

.reasonsObject



93
94
95
# File 'lib/bitex/specie_withdrawal.rb', line 93

def self.reasons
  { 0 => :not_cancelled, 1 => :insufficient_funds, 2 => :destination_invalid }
end

.statusesObject



89
90
91
# File 'lib/bitex/specie_withdrawal.rb', line 89

def self.statuses
  { 1 => :received, 2 => :pending, 3 => :done, 4 => :cancelled }
end