Class: Amzwish::Wishlist

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/amzwish/wishlist.rb

Defined Under Namespace

Classes: Page

Instance Method Summary collapse

Constructor Details

#initialize(email, website = Services::WebsiteWrapper.new) ⇒ Wishlist

Returns a new instance of Wishlist.



5
6
7
8
# File 'lib/amzwish/wishlist.rb', line 5

def initialize(email, website = Services::WebsiteWrapper.new)
  @email = email
  @website = website
end

Instance Method Details

#booksObject



10
11
12
# File 'lib/amzwish/wishlist.rb', line 10

def books
  to_a
end

#eachObject Also known as: each_book



14
15
16
17
# File 'lib/amzwish/wishlist.rb', line 14

def each
   lists = @website.find_for(@email)
   each_page(lists[0][:id]){|p| p.books.each{|b| yield b}}
end