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.



37384
37385
37386
37387
37388
37389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37384

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.



37382
37383
37384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37382

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



37382
37383
37384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37382

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37395
37396
37397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37395

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

#to_hashObject



37399
37400
37401
37402
37403
37404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37399

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

#to_jsonObject



37391
37392
37393
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37391

def to_json
  JSON.dump(to_hash)
end