class Io::Flow::V0::Models::InventoryUpdateForm

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.

Attributes

center[R]
idempotency_key[R]
item_number[R]
notes[R]
quantity[R]
type[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 46564
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 46579
def copy(incoming={})
  InventoryUpdateForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 46583
def to_hash
  {
    :center => center,
    :idempotency_key => idempotency_key,
    :item_number => item_number,
    :quantity => quantity,
    :type => type.value,
    :notes => notes
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 46575
def to_json
  JSON.dump(to_hash)
end