Class: Io::Flow::V0::Models::InventoryCheckResponseItem

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ InventoryCheckResponseItem

Returns a new instance of InventoryCheckResponseItem.



35993
35994
35995
35996
35997
35998
35999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35993

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:number, :quantity, :inventory_status], 'InventoryCheckResponseItem')
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @inventory_status = (x = opts.delete(:inventory_status); x.is_a?(::Io::Flow::V0::Models::InventoryStatus) ? x : ::Io::Flow::V0::Models::InventoryStatus.apply(x))
end

Instance Attribute Details

#inventory_statusObject (readonly)

Returns the value of attribute inventory_status.



35991
35992
35993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35991

def inventory_status
  @inventory_status
end

#numberObject (readonly)

Returns the value of attribute number.



35991
35992
35993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35991

def number
  @number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



35991
35992
35993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35991

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



36005
36006
36007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36005

def copy(incoming={})
  InventoryCheckResponseItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



36009
36010
36011
36012
36013
36014
36015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36009

def to_hash
  {
    :number => number,
    :quantity => quantity,
    :inventory_status => inventory_status.value
  }
end

#to_jsonObject



36001
36002
36003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36001

def to_json
  JSON.dump(to_hash)
end