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.



46136
46137
46138
46139
46140
46141
46142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46136

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.



46134
46135
46136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46134

def inventory_status
  @inventory_status
end

#numberObject (readonly)

Returns the value of attribute number.



46134
46135
46136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46134

def number
  @number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



46134
46135
46136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46134

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46148
46149
46150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46148

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

#to_hashObject



46152
46153
46154
46155
46156
46157
46158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46152

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

#to_jsonObject



46144
46145
46146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46144

def to_json
  JSON.dump(to_hash)
end