Sha256: af058d8e4a45cce1f7548344f393f1c91c020d1414ded5d448c6ac48bef84b73

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

class Bitcoin::Ssymbol

  attr_accessor :id, :baseCurrency, :quoteCurrency, :quantityIncrement, :tickSize, :takeLiquidityRate, :provideLiquidityRate, :feeCurrency

  def display_details
    puts <<-DOC
    ID: #{@id}
    Base Currency: #{@baseCurrency} || Quote Currency: #{@quoteCurrency}
    Quantity Increment: #{@quantityIncrement} || Tick Size: #{@tickSize}
    Take Liquidity Rate: #{@takeLiquidityRate} || Provide Liquidity Rate: #{@provideLiquidityRate}
    Fee Currency: #{@feeCurrency}

    DOC
  end

  def self.new_from_object(data)
    s = Bitcoin::Ssymbol.new
    s.id = data['id']
    s.baseCurrency = data['baseCurrency']
    s.quoteCurrency = data['quoteCurrency']
    s.quantityIncrement = data['quantityIncrement']
    s.tickSize = data['tickSize']
    s.takeLiquidityRate = data['takeLiquidityRate']
    s.provideLiquidityRate = data['provideLiquidityRate']
    s.feeCurrency = data['feeCurrency']
    s
  end

  def self.all
    data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/symbol"))
    data.map{ |ssymbol|
      Bitcoin::Ssymbol.new_from_object(ssymbol)
    }
  end

  def self.new_from_symbol_name(symbol_name)
    data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/symbol/#{symbol_name}"))
    Bitcoin::Ssymbol.new_from_object(data)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoin-api-0.1.1 lib/bitcoin/ssymbol.rb