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.



14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14451

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



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def description
  @description
end

#maxObject (readonly)

Returns the value of attribute max.



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def max
  @max
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



14449
14450
14451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14449

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14466
14467
14468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14466

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

#to_hashObject



14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14470

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

#to_jsonObject



14462
14463
14464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14462

def to_json
  JSON.dump(to_hash)
end