Sha256: 624cc013c3bed8a9ca89fa98d0c7301b2beed6bc085edb53fbe97a9ced7ffbc0

Contents?: true

Size: 678 Bytes

Versions: 7

Compression:

Stored size: 678 Bytes

Contents

module Lipseys
  class Inventory < Base

    def initialize(options = {})
      requires!(options, :username, :password)

      @client = Lipseys::Client.new(username: options[:username], password: options[:password])
    end

    def self.all(options = {})
      requires!(options, :username, :password)

      new(options).all
    end
    class << self; alias_method :quantity, :all; end

    def all
      @client.items.pricing_quantity_feed[:data][:items].map { |item| map_hash(item) }
    end

    private

    def map_hash(item)
      {
        item_identifier: item[:itemNumber],
        quantity: item[:quantity],
        price: item[:price],
      }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lipseys-6.2.1 lib/lipseys/inventory.rb
lipseys-6.2.0 lib/lipseys/inventory.rb
lipseys-6.1.1 lib/lipseys/inventory.rb
lipseys-6.1.0 lib/lipseys/inventory.rb
lipseys-6.0.2 lib/lipseys/inventory.rb
lipseys-6.0.1 lib/lipseys/inventory.rb
lipseys-6.0.0 lib/lipseys/inventory.rb