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



39334
39335
39336
39337
39338
39339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39334

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.



39332
39333
39334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39332

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



39332
39333
39334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39332

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39345
39346
39347
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39345

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

#to_hashObject



39349
39350
39351
39352
39353
39354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39349

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

#to_jsonObject



39341
39342
39343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39341

def to_json
  JSON.dump(to_hash)
end