Class: Io::Flow::V0::Models::InventoryRequestItem

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 = {}) ⇒ InventoryRequestItem

Returns a new instance of InventoryRequestItem.



25922
25923
25924
25925
25926
25927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25922

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:number, :quantity], 'InventoryRequestItem')
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



25920
25921
25922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25920

def number
  @number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



25920
25921
25922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25920

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25933
25934
25935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25933

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

#to_hashObject



25937
25938
25939
25940
25941
25942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25937

def to_hash
  {
    :number => number,
    :quantity => quantity
  }
end

#to_jsonObject



25929
25930
25931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25929

def to_json
  JSON.dump(to_hash)
end