Class: Io::Flow::V0::Models::CreditPaymentForm

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

Returns a new instance of CreditPaymentForm.



14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14053

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_number, :description, :amount, :currency], 'CreditPaymentForm')
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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)
  @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

#amountObject (readonly)

Returns the value of attribute amount.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



14051
14052
14053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14051

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14068
14069
14070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14068

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

#to_hashObject



14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14072

def to_hash
  {
    :order_number => order_number,
    :key => key,
    :description => description,
    :amount => amount,
    :currency => currency,
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



14064
14065
14066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14064

def to_json
  JSON.dump(to_hash)
end