Class: Fcoin::TickerFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Fcoin::TickerFormatter
- Defined in:
- lib/fcoin/formatter/ticker_formatter.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
-
#formatted_body ⇒ Hash
Format response body for JSON.
-
#initialize(body) ⇒ TickerFormatter
constructor
A new instance of TickerFormatter.
Constructor Details
#initialize(body) ⇒ TickerFormatter
Returns a new instance of TickerFormatter.
8 9 10 |
# File 'lib/fcoin/formatter/ticker_formatter.rb', line 8 def initialize(body) self.body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/fcoin/formatter/ticker_formatter.rb', line 6 def body @body end |
Instance Method Details
#formatted_body ⇒ Hash
Format response body for JSON
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fcoin/formatter/ticker_formatter.rb', line 15 def formatted_body # https://developer.fcoin.com/en.html ticker = body['data']['ticker'].dup self.body['data']['ticker'] = { "latest_price" => ticker[0], "most_recent_trade_vol" => ticker[1], "max_buy_price" => ticker[2], "max_buy_amount" => ticker[3], "min_sell_price" => ticker[4], "min_sell_amount" => ticker[5], "trade_price_yesterday" => ticker[6], "highest_price_today" => ticker[7], "lowest_price_today" => ticker[8], "symbol_base_vol_today" => ticker[9], "symbol_base_price_today" => ticker[10] } body end |