Class: Io::Flow::V0::Models::B2bCreditMemo
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::B2bCreditMemo
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
The b2b credit memo represents a refund transaction between Flow and one of our clients
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#buyer ⇒ Object
readonly
Returns the value of attribute buyer.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#invoice ⇒ Object
readonly
Returns the value of attribute invoice.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#seller ⇒ Object
readonly
Returns the value of attribute seller.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ B2bCreditMemo
constructor
A new instance of B2bCreditMemo.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ B2bCreditMemo
Returns a new instance of B2bCreditMemo.
23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23760 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number, :buyer, :seller, :status, :date, :key, :invoice, :lines, :documents, :attributes], 'B2bCreditMemo') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @buyer = (x = opts.delete(:buyer); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntity) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntity.new(x)) @seller = (x = opts.delete(:seller); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntity) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntity.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceStatus) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceStatus.apply(x)) @date = HttpClient::Preconditions.assert_class('date', HttpClient::Helper.to_date_time_iso8601(opts.delete(:date)), DateTime) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @invoice = (x = opts.delete(:invoice); x.is_a?(::Io::Flow::V0::Models::B2bInvoiceReference) ? x : ::Io::Flow::V0::Models::B2bInvoiceReference.new(x)) @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLine) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLine.from_json(x)) } @documents = HttpClient::Preconditions.assert_class('documents', opts.delete(:documents), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceDocument) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceDocument.new(x)) } @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def attributes @attributes end |
#buyer ⇒ Object (readonly)
Returns the value of attribute buyer.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def buyer @buyer end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def date @date end |
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def documents @documents end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def id @id end |
#invoice ⇒ Object (readonly)
Returns the value of attribute invoice.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def invoice @invoice end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def key @key end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def lines @lines end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def number @number end |
#seller ⇒ Object (readonly)
Returns the value of attribute seller.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def seller @seller end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
23758 23759 23760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23758 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23780 23781 23782 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23780 def copy(incoming={}) B2bCreditMemo.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23784 def to_hash { :id => id, :number => number, :buyer => buyer.to_hash, :seller => seller.to_hash, :status => status.value, :date => date, :key => key, :invoice => invoice.to_hash, :lines => lines.map { |o| o.to_hash }, :documents => documents.map { |o| o.to_hash }, :attributes => attributes } end |
#to_json ⇒ Object
23776 23777 23778 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23776 def to_json JSON.dump(to_hash) end |