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.
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.
29216 29217 29218 29219 29220 29221 29222 29223 29224 29225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29216 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)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def amount @amount end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def base @base end |
#capture ⇒ Object (readonly)
Returns the value of attribute capture.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def capture @capture end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def id @id end |
#refund ⇒ Object (readonly)
Returns the value of attribute refund.
29214 29215 29216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29214 def refund @refund end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29231 29232 29233 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231 def copy(incoming={}) RefundCapture.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29235 29236 29237 29238 29239 29240 29241 29242 29243 29244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29235 def to_hash { :id => id, :refund => refund.to_hash, :capture => capture.to_hash, :amount => amount, :currency => currency, :base => base.to_hash } end |
#to_json ⇒ Object
29227 29228 29229 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29227 def to_json JSON.dump(to_hash) end |