Class: XRBP::Model::Market
- Extended by:
- Base::ClassMethods
- Defined in:
- lib/xrbp/model/market.rb
Instance Attribute Summary collapse
-
#route ⇒ Object
Returns the value of attribute route.
Attributes included from Base::ClassMethods
Attributes inherited from Base
Class Method Summary collapse
-
.all(opts = {}) ⇒ Object
Retrieve list of markets via WebClient::Connection.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Market
constructor
A new instance of Market.
-
#quotes(opts = {}) ⇒ Object
Retrieve list of quotes for market via WebClient::Connection.
- #set_opts(opts = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(opts = {}) ⇒ Market
Returns a new instance of Market.
27 28 29 |
# File 'lib/xrbp/model/market.rb', line 27 def initialize(opts={}) set_opts(opts) end |
Instance Attribute Details
#route ⇒ Object
Returns the value of attribute route.
25 26 27 |
# File 'lib/xrbp/model/market.rb', line 25 def route @route end |
Class Method Details
.all(opts = {}) ⇒ Object
Retrieve list of markets via WebClient::Connection
15 16 17 18 19 20 21 22 23 |
# File 'lib/xrbp/model/market.rb', line 15 def self.all(opts={}) set_opts(opts) connection.url = "https://api.cryptowat.ch/assets/xrp" connection.add_plugin :result_parser unless connection.plugin?(:result_parser) connection.add_plugin Parsers::Market unless connection.plugin?(Parsers::Market) connection.perform end |
Instance Method Details
#quotes(opts = {}) ⇒ Object
Retrieve list of quotes for market via WebClient::Connection
41 42 43 44 45 46 47 48 49 |
# File 'lib/xrbp/model/market.rb', line 41 def quotes(opts={}) set_opts(opts) connection.url = self.route connection.add_plugin :result_parser unless connection.plugin?(:result_parser) connection.add_plugin Parsers::Quote unless connection.plugin?(Parsers::Quote) connection.perform end |
#set_opts(opts = {}) ⇒ Object
31 32 33 34 |
# File 'lib/xrbp/model/market.rb', line 31 def set_opts(opts={}) super opts @route = opts[:route] if opts[:route] end |