class Bitex::UsdWithdrawal

A withdrawal of USD from your bitex.la balance

Attributes

amount[RW]

@!attribute amount

@return [BigDecimal] Amount withdrawn from your bitex USD balance.
country[RW]

@!attribute countr

Returns ISO country code.
created_at[RW]

@!attribute created_at

@return [Time] Time when this withdrawal was requested by you.
currency[RW]

@!attribute currency

Currency for this withdrawal.
id[RW]

@!attribute id

@return [Integer] This UsdWithdrawal's unique ID.
instructions[RW]

@!attribute instructions

kyc_profile_id[RW]

@!attribute kyc_profile_id

label[RW]

@!attribute label

payment_method[RW]

@!attribute payment_method

Returns the payment method for this withdrawal.
* :international_bank International bank transfer.
* :bb we'll contact you regarding this withdrawal.
reason[RW]

@!attribute reason

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.
status[RW]

@!attribute status

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.

Public Class Methods

all() click to toggle source
# 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) click to toggle source

rubocop:enable Metrics/AbcSize

# 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) click to toggle source
# File lib/bitex/usd_withdrawal.rb, line 84
def self.find(id)
  from_json(Api.private(:get, "/private/usd/withdrawals/#{id}"))
end
from_json(json) click to toggle source

@visibility private rubocop:disable Metrics/AbcSize

# File lib/bitex/usd_withdrawal.rb, line 58
def self.from_json(json)
  Api.from_json(new, json) do |thing|
    thing.amount = (json[3].presence || 0).to_d
    thing.status = statuses[json[4]]
    thing.reason = reasons[json[5]]
    thing.country = json[6]
    thing.currency = json[7]
    thing.payment_method = payment_methods[json[8]]
    thing.label = json[9]
    thing.kyc_profile_id = json[10]
    thing.instructions = json[11]
  end
end
payment_methods() click to toggle source
# File lib/bitex/usd_withdrawal.rb, line 92
def self.payment_methods
  { 1 => :bb, 2 => :international_bank }
end
reasons() click to toggle source
# File lib/bitex/usd_withdrawal.rb, line 96
def self.reasons
  { 0 => :not_cancelled, 1 => :insufficient_funds, 2 => :no_instructions, 3 => :recipient_unknown }
end
statuses() click to toggle source
# File lib/bitex/usd_withdrawal.rb, line 100
def self.statuses
  { 1 => :received, 2 => :pending, 3 => :done, 4 => :cancelled }
end