Class: Io::Flow::V0::Models::CreditPaymentForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CreditPaymentForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CreditPaymentForm
constructor
A new instance of CreditPaymentForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CreditPaymentForm
Returns a new instance of CreditPaymentForm.
37624 37625 37626 37627 37628 37629 37630 37631 37632 37633 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37624 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:order_number, :description, :amount, :max, :currency], 'CreditPaymentForm') @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @max = HttpClient::Preconditions.assert_class('max', HttpClient::Helper.to_big_decimal(opts.delete(:max)), BigDecimal) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def attributes @attributes end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def description @description end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def max @max end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
37622 37623 37624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37622 def order_number @order_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37639 37640 37641 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37639 def copy(incoming={}) CreditPaymentForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37643 37644 37645 37646 37647 37648 37649 37650 37651 37652 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37643 def to_hash { :order_number => order_number, :description => description, :amount => amount.to_f.to_s, :max => max.to_f.to_s, :currency => currency, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
37635 37636 37637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37635 def to_json JSON.dump(to_hash) end |