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
-
#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.
47350 47351 47352 47353 47354 47355 47356 47357 47358 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47350 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)) end |
Instance Attribute Details
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
47348 47349 47350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47348 def item_number @item_number end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
47348 47349 47350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47348 def notes @notes end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
47348 47349 47350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47348 def order_number @order_number end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
47348 47349 47350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47348 def quantity @quantity end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
47348 47349 47350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47348 def reason @reason end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47364 47365 47366 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47364 def copy(incoming={}) ReturnLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
47368 47369 47370 47371 47372 47373 47374 47375 47376 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47368 def to_hash { :item_number => item_number, :order_number => order_number, :quantity => quantity, :reason => reason.nil? ? nil : reason.to_hash, :notes => notes } end |
#to_json ⇒ Object
47360 47361 47362 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47360 def to_json JSON.dump(to_hash) end |