Class: Io::Flow::V0::Models::MerchantGiftCardBalance
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::MerchantGiftCardBalance
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ MerchantGiftCardBalance
constructor
A new instance of MerchantGiftCardBalance.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ MerchantGiftCardBalance
Returns a new instance of MerchantGiftCardBalance.
38748 38749 38750 38751 38752 38753 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38748 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
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
38746 38747 38748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38746 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
38746 38747 38748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38746 def currency @currency end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38759 38760 38761 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38759 def copy(incoming={}) MerchantGiftCardBalance.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38763 38764 38765 38766 38767 38768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38763 def to_hash { :amount => amount.to_f.to_s, :currency => currency } end |
#to_json ⇒ Object
38755 38756 38757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38755 def to_json JSON.dump(to_hash) end |