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.



27765
27766
27767
27768
27769
27770
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27765

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.



27763
27764
27765
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27763

def number
  @number
end

#quantityObject (readonly)

Returns the value of attribute quantity.



27763
27764
27765
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27763

def quantity
  @quantity
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27776
27777
27778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27776

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

#to_hashObject



27780
27781
27782
27783
27784
27785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27780

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

#to_jsonObject



27772
27773
27774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27772

def to_json
  JSON.dump(to_hash)
end