Class: Bitstamper::Models::TradingPair
- Defined in:
- lib/bitstamper/models/trading_pair.rb
Constant Summary collapse
- MAPPING =
{ "name" => :string, "url_symbol" => :string, "description" => :string, "base_decimals" => :integer, "counter_decimals" => :integer, "minimum_order" => :string, "trading" => :string, }
Instance Attribute Summary collapse
-
#base_decimals ⇒ Object
Returns the value of attribute base_decimals.
-
#counter_decimals ⇒ Object
Returns the value of attribute counter_decimals.
-
#description ⇒ Object
Returns the value of attribute description.
-
#minimum_order ⇒ Object
Returns the value of attribute minimum_order.
-
#name ⇒ Object
Returns the value of attribute name.
-
#trading ⇒ Object
Returns the value of attribute trading.
-
#url_symbol ⇒ Object
Returns the value of attribute url_symbol.
Class Method Summary collapse
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#initialize(hash) ⇒ TradingPair
constructor
A new instance of TradingPair.
Methods inherited from Base
Constructor Details
#initialize(hash) ⇒ TradingPair
Returns a new instance of TradingPair.
17 18 19 20 21 22 23 |
# File 'lib/bitstamper/models/trading_pair.rb', line 17 def initialize(hash) hash.each do |key, value| type = ::Bitstamper::Models::TradingPair::MAPPING.fetch(key, nil) value = value && type ? ::Bitstamper::Utilities::convert_value(value, type) : value self.send("#{key}=", value) if self.respond_to?(key) end end |
Instance Attribute Details
#base_decimals ⇒ Object
Returns the value of attribute base_decimals.
5 6 7 |
# File 'lib/bitstamper/models/trading_pair.rb', line 5 def base_decimals @base_decimals end |
#counter_decimals ⇒ Object
Returns the value of attribute counter_decimals.
5 6 7 |
# File 'lib/bitstamper/models/trading_pair.rb', line 5 def counter_decimals @counter_decimals end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/bitstamper/models/trading_pair.rb', line 4 def description @description end |
#minimum_order ⇒ Object
Returns the value of attribute minimum_order.
5 6 7 |
# File 'lib/bitstamper/models/trading_pair.rb', line 5 def minimum_order @minimum_order end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/bitstamper/models/trading_pair.rb', line 4 def name @name end |
#trading ⇒ Object
Returns the value of attribute trading.
5 6 7 |
# File 'lib/bitstamper/models/trading_pair.rb', line 5 def trading @trading end |
#url_symbol ⇒ Object
Returns the value of attribute url_symbol.
4 5 6 |
# File 'lib/bitstamper/models/trading_pair.rb', line 4 def url_symbol @url_symbol end |
Class Method Details
.parse(data) ⇒ Object
29 30 31 |
# File 'lib/bitstamper/models/trading_pair.rb', line 29 def self.parse(data) data&.collect { |item| ::Bitstamper::Models::TradingPair.new(item) } end |
Instance Method Details
#enabled? ⇒ Boolean
25 26 27 |
# File 'lib/bitstamper/models/trading_pair.rb', line 25 def enabled? self.trading.downcase.strip.eql?("enabled") end |