Class: Io::Flow::V0::Models::InventoryUpdateForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::InventoryUpdateForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Form used to create an update on inventory. If inventory for center/item has not been previously created, a new row is created for the center/item tuple.
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#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 = {}) ⇒ InventoryUpdateForm
constructor
A new instance of InventoryUpdateForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ InventoryUpdateForm
Returns a new instance of InventoryUpdateForm.
36392 36393 36394 36395 36396 36397 36398 36399 36400 36401 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36392 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:center, :idempotency_key, :item_number, :quantity, :type], 'InventoryUpdateForm') @center = HttpClient::Preconditions.assert_class('center', opts.delete(:center), String) @idempotency_key = HttpClient::Preconditions.assert_class('idempotency_key', opts.delete(:idempotency_key), String) @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @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)) @notes = (x = opts.delete(:notes); x.nil? ? nil : HttpClient::Preconditions.assert_class('notes', HttpClient::Helper.to_object(x), Hash)) end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def center @center end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def idempotency_key @idempotency_key end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def item_number @item_number end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def notes @notes end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def quantity @quantity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
36390 36391 36392 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36390 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36407 36408 36409 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36407 def copy(incoming={}) InventoryUpdateForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36411 36412 36413 36414 36415 36416 36417 36418 36419 36420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36411 def to_hash { :center => center, :idempotency_key => idempotency_key, :item_number => item_number, :quantity => quantity, :type => type.value, :notes => notes } end |
#to_json ⇒ Object
36403 36404 36405 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36403 def to_json JSON.dump(to_hash) end |