Class: Io::Flow::V0::Models::PaymentCaptureForm

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

Returns a new instance of PaymentCaptureForm.



56501
56502
56503
56504
56505
56506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56501

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, 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.



56499
56500
56501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56499

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



56499
56500
56501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56499

def attributes
  @attributes
end

#currencyObject (readonly)

Returns the value of attribute currency.



56499
56500
56501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56499

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56512
56513
56514
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56512

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

#to_hashObject



56516
56517
56518
56519
56520
56521
56522
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56516

def to_hash
  {
    :amount => amount.to_f.to_s,
    :currency => currency,
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



56508
56509
56510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56508

def to_json
  JSON.dump(to_hash)
end