Class: Bitex::UsdWithdrawal

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

Overview

A withdrawal of USD from your bitex.la balance

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#amountBigDecimal

Returns Amount withdrawn from your bitex USD balance.

Returns:

  • (BigDecimal)

    Amount withdrawn from your bitex USD balance.



15
16
17
# File 'lib/bitex/usd_withdrawal.rb', line 15

def amount
  @amount
end

#countrObject

Returns ISO country code.



35
# File 'lib/bitex/usd_withdrawal.rb', line 35

attr_accessor :country

#countryObject

Returns the value of attribute country.



35
36
37
# File 'lib/bitex/usd_withdrawal.rb', line 35

def country
  @country
end

#created_atTime

Returns Time when this withdrawal was requested by you.

Returns:

  • (Time)

    Time when this withdrawal was requested by you.



11
12
13
# File 'lib/bitex/usd_withdrawal.rb', line 11

def created_at
  @created_at
end

#currencyObject

Currency for this withdrawal.



39
40
41
# File 'lib/bitex/usd_withdrawal.rb', line 39

def currency
  @currency
end

#idInteger

Returns This UsdWithdrawal’s unique ID.

Returns:

  • (Integer)

    This UsdWithdrawal’s unique ID.



7
8
9
# File 'lib/bitex/usd_withdrawal.rb', line 7

def id
  @id
end

#instructionsObject



54
55
56
# File 'lib/bitex/usd_withdrawal.rb', line 54

def instructions
  @instructions
end

#kyc_profile_idObject



51
52
53
# File 'lib/bitex/usd_withdrawal.rb', line 51

def kyc_profile_id
  @kyc_profile_id
end

#labelObject



48
49
50
# File 'lib/bitex/usd_withdrawal.rb', line 48

def label
  @label
end

#payment_methodObject

Returns the payment method for this withdrawal.

  • :international_bank International bank transfer.

  • :bb we’ll contact you regarding this withdrawal.



45
46
47
# File 'lib/bitex/usd_withdrawal.rb', line 45

def payment_method
  @payment_method
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.

  • :no_instructions We could not understand the instructions you provided.

  • :recipient_unknown we could not issue this withdrawal because you’re not the receiving party.



31
32
33
# File 'lib/bitex/usd_withdrawal.rb', line 31

def reason
  @reason
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 it’s on its way through the withdrawal channel you chose.

  • :cancelled your withdrawal could not be processed.



23
24
25
# File 'lib/bitex/usd_withdrawal.rb', line 23

def status
  @status
end

Class Method Details

.allObject



88
89
90
# File 'lib/bitex/usd_withdrawal.rb', line 88

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

.create!(country, amount, currency, method, instructions, label, profile = nil) ⇒ Object

rubocop:enable Metrics/AbcSize



73
74
75
76
77
78
79
80
81
82
# File 'lib/bitex/usd_withdrawal.rb', line 73

def self.create!(country, amount, currency, method, instructions, label, profile = nil)
  from_json(
    Api.private(
      :post,
      '/private/usd/withdrawals',
      country: country, amount: amount, currency: currency, payment_method: method, instructions: instructions, label: label,
      kyc_profile_id: profile
    )
  )
end

.find(id) ⇒ Object



84
85
86
# File 'lib/bitex/usd_withdrawal.rb', line 84

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

.payment_methodsObject



92
93
94
# File 'lib/bitex/usd_withdrawal.rb', line 92

def self.payment_methods
  { 1 => :bb, 2 => :international_bank }
end

.reasonsObject



96
97
98
# File 'lib/bitex/usd_withdrawal.rb', line 96

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

.statusesObject



100
101
102
# File 'lib/bitex/usd_withdrawal.rb', line 100

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