Class: Io::Flow::V0::Models::RefundCapture
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RefundCapture
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Refund captures provide the detailed information on the amount refunded against a specific capture
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#capture ⇒ Object
readonly
Returns the value of attribute capture.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#refund ⇒ Object
readonly
Returns the value of attribute refund.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ RefundCapture
constructor
A new instance of RefundCapture.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RefundCapture
Returns a new instance of RefundCapture.
47645 47646 47647 47648 47649 47650 47651 47652 47653 47654 47655 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47645 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :refund, :capture, :amount, :currency, :base], 'RefundCapture') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @refund = (x = opts.delete(:refund); x.is_a?(::Io::Flow::V0::Models::Refund) ? x : ::Io::Flow::V0::Models::Refund.new(x)) @capture = (x = opts.delete(:capture); x.is_a?(::Io::Flow::V0::Models::Capture) ? x : ::Io::Flow::V0::Models::Capture.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) @base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x)) @status = (x = (x = opts.delete(:status); x.nil? ? "succeeded" : x); x.is_a?(::Io::Flow::V0::Models::RefundStatus) ? x : ::Io::Flow::V0::Models::RefundStatus.apply(x)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def amount @amount end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def base @base end |
#capture ⇒ Object (readonly)
Returns the value of attribute capture.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def capture @capture end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def id @id end |
#refund ⇒ Object (readonly)
Returns the value of attribute refund.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def refund @refund end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
47643 47644 47645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47643 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47661 47662 47663 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47661 def copy(incoming={}) RefundCapture.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
47665 47666 47667 47668 47669 47670 47671 47672 47673 47674 47675 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47665 def to_hash { :id => id, :refund => refund.to_hash, :capture => capture.to_hash, :amount => amount.to_f.to_s, :currency => currency, :base => base.to_hash, :status => status.value } end |
#to_json ⇒ Object
47657 47658 47659 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47657 def to_json JSON.dump(to_hash) end |