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.



50164
50165
50166
50167
50168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50164

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))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



50162
50163
50164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50162

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



50162
50163
50164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50162

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50174
50175
50176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50174

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

#to_hashObject



50178
50179
50180
50181
50182
50183
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50178

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

#to_jsonObject



50170
50171
50172
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50170

def to_json
  JSON.dump(to_hash)
end