Class: Io::Flow::V0::Models::Capture
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Capture
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Capture actually transfers funds. You can capture as many times as you’d like up until the total amount of the authorization has been captured or the authorization otherwise becomes unavailable (e.g. expires).
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Capture
constructor
A new instance of Capture.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Capture
Returns a new instance of Capture.
6510 6511 6512 6513 6514 6515 6516 6517 6518 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6510 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :authorization, :amount, :currency], 'Capture') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::AuthorizationReference) ? x : ::Io::Flow::V0::Models::AuthorizationReference.new(x)) @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) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
6508 6509 6510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6508 def amount @amount end |
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
6508 6509 6510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6508 def @authorization end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
6508 6509 6510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6508 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6508 6509 6510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6508 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6508 6509 6510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6508 def key @key end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
6524 6525 6526 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6524 def copy(incoming={}) Capture.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
6528 6529 6530 6531 6532 6533 6534 6535 6536 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6528 def to_hash { :id => id, :key => key, :authorization => .to_hash, :amount => amount, :currency => currency } end |
#to_json ⇒ Object
6520 6521 6522 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6520 def to_json JSON.dump(to_hash) end |