Class: Io::Flow::V0::Models::InventoryUpdate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::InventoryUpdate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a single update on inventory quantity
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ InventoryUpdate
constructor
A new instance of InventoryUpdate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ InventoryUpdate
Returns a new instance of InventoryUpdate.
21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21453 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :idempotency_key, :center, :item, :notes, :quantity, :type], 'InventoryUpdate') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @idempotency_key = HttpClient::Preconditions.assert_class('idempotency_key', opts.delete(:idempotency_key), String) @center = (x = opts.delete(:center); x.is_a?(::Io::Flow::V0::Models::InventoryCenterReference) ? x : ::Io::Flow::V0::Models::InventoryCenterReference.new(x)) @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::InventoryItemReference) ? x : ::Io::Flow::V0::Models::InventoryItemReference.new(x)) @notes = HttpClient::Preconditions.assert_class('notes', HttpClient::Helper.to_object(opts.delete(:notes)), Hash) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::UpdateType) ? x : ::Io::Flow::V0::Models::UpdateType.apply(x)) end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def center @center end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def id @id end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def idempotency_key @idempotency_key end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def item @item end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def notes @notes end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def quantity @quantity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
21451 21452 21453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21451 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
21469 21470 21471 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21469 def copy(incoming={}) InventoryUpdate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21473 def to_hash { :id => id, :idempotency_key => idempotency_key, :center => center.to_hash, :item => item.to_hash, :notes => notes, :quantity => quantity, :type => type.value } end |
#to_json ⇒ Object
21465 21466 21467 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21465 def to_json JSON.dump(to_hash) end |