Class: Btce::Trade

Inherits:
Object
  • Object
show all
Defined in:
lib/btce.rb

Constant Summary collapse

JSON_METHODS =
%w(date price amount tid price_currency item trade_type)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



193
194
195
# File 'lib/btce.rb', line 193

def json
  @json
end

Class Method Details

.new_from_json(json) ⇒ Object



200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/btce.rb', line 200

def new_from_json(json)
  result = Trade.new
  result.json = json
  if json.is_a? Hash
    JSON_METHODS.each do |method|
      instance_eval %{
        result.#{method} = json["#{method}"]
      }
    end
  end
  result
end