Class: Io::Flow::V0::Models::MonthlyAverageVolume

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ MonthlyAverageVolume

Returns a new instance of MonthlyAverageVolume.



46855
46856
46857
46858
46859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46855

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



46853
46854
46855
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46853

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



46853
46854
46855
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46853

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46865
46866
46867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46865

def copy(incoming={})
  MonthlyAverageVolume.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



46869
46870
46871
46872
46873
46874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46869

def to_hash
  {
    :amount => amount.to_f.to_s,
    :currency => currency
  }
end

#to_jsonObject



46861
46862
46863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46861

def to_json
  JSON.dump(to_hash)
end