Sha256: 32e2d86c8040b9c52e84344dd5fbb365b103775dadaadb12ae3aa724811cb463

Contents?: true

Size: 686 Bytes

Versions: 19

Compression:

Stored size: 686 Bytes

Contents

module AmazonSellerCentral
  class Inventory
    module ClassMethods
      def load_first_page
        mech = AmazonSellerCentral.mechanizer
        mech.login_to_seller_central
        manage_inventory = mech.follow_link_with(:text => "Manage Inventory")
        InventoryPage.new( :page => manage_inventory, :page_no => 1, :uri_base => manage_inventory.uri.to_s, :agent => mech )
      end

      def load_all_pages
        pages = [load_first_page]
        while pages.last.has_next?
          pages << pages.last.next_page
          yield pages.last if block_given?
        end
        pages
      end
      alias each_page load_all_pages
    end

    extend ClassMethods
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
amazon_seller_central-0.3.2 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.3.1 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.3.0 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.16 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.15 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.14 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.13 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.12 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.11 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.10 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.9 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.8 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.7 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.6 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.5 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.4 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.3 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.2 lib/amazon_seller_central/inventory.rb
amazon_seller_central-0.2.1 lib/amazon_seller_central/inventory.rb