Class: Io::Flow::V0::Models::ReturnLineItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ReturnLineItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ReturnLineItem
constructor
A new instance of ReturnLineItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ReturnLineItem
Returns a new instance of ReturnLineItem.
48767 48768 48769 48770 48771 48772 48773 48774 48775 48776 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48767 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item_number, :quantity], 'ReturnLineItem') @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String)) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @reason = (x = opts.delete(:reason); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ReturnReason) ? x : ::Io::Flow::V0::Models::ReturnReason.new(x))) @notes = (x = opts.delete(:notes); x.nil? ? nil : HttpClient::Preconditions.assert_class('notes', x, String)) @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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def attributes @attributes end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def item_number @item_number end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def notes @notes end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def order_number @order_number end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def quantity @quantity end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
48765 48766 48767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48765 def reason @reason end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
48782 48783 48784 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48782 def copy(incoming={}) ReturnLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
48786 48787 48788 48789 48790 48791 48792 48793 48794 48795 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48786 def to_hash { :item_number => item_number, :order_number => order_number, :quantity => quantity, :reason => reason.nil? ? nil : reason.to_hash, :notes => notes, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
48778 48779 48780 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48778 def to_json JSON.dump(to_hash) end |