Class: XRBP::Model::Parsers::Market

Inherits:
PluginBase show all
Defined in:
lib/xrbp/model/parsers/market.rb

Overview

Market List data parser

Instance Attribute Summary

Attributes inherited from PluginBase

#connection

Instance Method Summary collapse

Methods inherited from PluginBase

#initialize

Constructor Details

This class inherits a constructor from XRBP::PluginBase

Instance Method Details

#parse_result(res, req) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/xrbp/model/parsers/market.rb', line 13

def parse_result(res, req)
  j = JSON.parse(res)
  return res unless j["result"] &&
                    j["result"]["markets"] &&
                    j["result"]["markets"]["base"]
  j["result"]["markets"]["base"]
      .collect { |market|
    {:exchange => market["exchange"],
     :currency => market["pair"][3..-1],
     :route    => market["route"]}
  }
end

#parser_priorityObject



9
10
11
# File 'lib/xrbp/model/parsers/market.rb', line 9

def parser_priority
  0
end