Class: Io::Flow::V0::Models::CreditPaymentPutForm

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

Returns a new instance of CreditPaymentPutForm.



14089
14090
14091
14092
14093
14094
14095
14096
14097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14089

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_number, :description, :amount, :currency], 'CreditPaymentPutForm')
  @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)
  @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.



14087
14088
14089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



14087
14088
14089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



14087
14088
14089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



14087
14088
14089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

def description
  @description
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



14087
14088
14089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14103
14104
14105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14103

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

#to_hashObject



14107
14108
14109
14110
14111
14112
14113
14114
14115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14107

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

#to_jsonObject



14099
14100
14101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14099

def to_json
  JSON.dump(to_hash)
end