Class: Io::Flow::V0::Models::MerchantGiftCardBalance

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 = {}) ⇒ MerchantGiftCardBalance

Returns a new instance of MerchantGiftCardBalance.



36607
36608
36609
36610
36611
36612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36607

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount, :currency], 'MerchantGiftCardBalance')
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



36605
36606
36607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36605

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



36605
36606
36607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36605

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



36618
36619
36620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36618

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

#to_hashObject



36622
36623
36624
36625
36626
36627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36622

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

#to_jsonObject



36614
36615
36616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36614

def to_json
  JSON.dump(to_hash)
end