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.



34138
34139
34140
34141
34142
34143
34144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34138

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.



34136
34137
34138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34136

def inventory_status
  @inventory_status
end

#numberObject (readonly)

Returns the value of attribute number.



34136
34137
34138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34136

def number
  @number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



34136
34137
34138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34136

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34150
34151
34152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34150

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

#to_hashObject



34154
34155
34156
34157
34158
34159
34160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34154

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

#to_jsonObject



34146
34147
34148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34146

def to_json
  JSON.dump(to_hash)
end