class Io::Flow::V0::Models::CreditMemoForm
A credit memo form defines the information needed to create a credit memo. You must provide a way to identify the refund issued - either by id, key or identifier.
Attributes
attributes[R]
lines[R]
refund_id[R]
refund_identifier[R]
refund_key[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37484 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:lines], 'CreditMemoForm') @refund_id = (x = opts.delete(:refund_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('refund_id', x, String)) @refund_key = (x = opts.delete(:refund_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('refund_key', x, String)) @refund_identifier = (x = opts.delete(:refund_identifier); x.nil? ? nil : HttpClient::Preconditions.assert_class('refund_identifier', x, String)) @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLineForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLineForm.from_json(x)) } @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
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37498 def copy(incoming={}) CreditMemoForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37502 def to_hash { :refund_id => refund_id, :refund_key => refund_key, :refund_identifier => refund_identifier, :lines => lines.map { |o| o.to_hash }, :attributes => attributes.nil? ? nil : attributes } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37494 def to_json JSON.dump(to_hash) end