lib/bitcoin/ssymbol.rb in bitcoin-api-0.1.0 vs lib/bitcoin/ssymbol.rb in bitcoin-api-0.1.1

- old
+ new

@@ -1,15 +1,18 @@ class Bitcoin::Ssymbol - attr_accessor :id, :baseCurrency, :quoteCurrency, :quantityIncrement, :tickSize, - :takeLiquidityRate, :provideLiquidityRate, :feeCurrency + attr_accessor :id, :baseCurrency, :quoteCurrency, :quantityIncrement, :tickSize, :takeLiquidityRate, :provideLiquidityRate, :feeCurrency - def self.all - data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/symbol")) - data.map{ |ssymbol| - Bitcoin::Ssymbol.new_from_object(ssymbol) - } + 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'] @@ -21,23 +24,18 @@ 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 - - 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 end