Method: Bitstamper::Models::TradingPair#initialize

Defined in:
lib/bitstamper/models/trading_pair.rb

#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