class Bitcoin::Currency

Attributes

crypto[RW]
delisted[RW]
fullName[RW]
id[RW]
payinConfirmations[RW]
payinEnabled[RW]
payinPaymentId[RW]
payoutEnabled[RW]
payoutFee[RW]
payoutIsPaymentId[RW]
transferEnabled[RW]

Public Class Methods

all() click to toggle source
# File lib/bitcoin/currency.rb, line 7
def self.all
  data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/currency"))
  data.map{  |currency|
    Bitcoin::Currency.new_from_object(currency)
   }
end
new_from_currency_name(name) click to toggle source
# File lib/bitcoin/currency.rb, line 14
def self.new_from_currency_name(name)
  data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/currency/#{name}"))
  Bitcoin::Currency.new_from_object(data)
end
new_from_object(data) click to toggle source
# File lib/bitcoin/currency.rb, line 19
def self.new_from_object(data)
  c = Bitcoin::Currency.new
  c.id = data['id']
  c.fullName = data['fullName']
  c.crypto = data['crypto']
  c.payoutFee = data['payoutFee']
  c.payoutFee = c.payoutFee.to_f / 100 if c.id == 'USD'
  c
end

Public Instance Methods

display_details() click to toggle source
# File lib/bitcoin/currency.rb, line 29
  def display_details
    puts <<-DOC
      #{@id} (#{@fullName})
      Cryptocurrency?: #{@crypto.to_s}
      Delisted?: #{@delisted.to_s}
      Pay-Out Fee: #{@payoutFee} #{@id}

    DOC
  end