class Lipseys::Inventory

Public Class Methods

all(options = {}) click to toggle source
# File lib/lipseys/inventory.rb, line 10
def self.all(options = {})
  requires!(options, :username, :password)

  new(options).all
end
Also aliased as: quantity
new(options = {}) click to toggle source
# File lib/lipseys/inventory.rb, line 4
def initialize(options = {})
  requires!(options, :username, :password)

  @client = Lipseys::Client.new(username: options[:username], password: options[:password])
end
quantity(options = {})
Alias for: all

Public Instance Methods

all() click to toggle source
# File lib/lipseys/inventory.rb, line 17
def all
  @client.items.pricing_quantity_feed[:data][:items].map { |item| map_hash(item) }
end

Private Instance Methods

map_hash(item) click to toggle source
# File lib/lipseys/inventory.rb, line 23
def map_hash(item)
  {
    item_identifier: item[:itemNumber],
    quantity: item[:quantity],
    price: item[:price],
  }
end