Class: WishlistPopulator

Inherits:
Object
  • Object
show all
Defined in:
lib/discogs/wishlist/populators/wishlist_populator.rb

Instance Method Summary collapse

Constructor Details

#initialize(wishlist:) ⇒ WishlistPopulator

Returns a new instance of WishlistPopulator.



4
5
6
# File 'lib/discogs/wishlist/populators/wishlist_populator.rb', line 4

def initialize(wishlist:)
  @wishlist = wishlist
end

Instance Method Details

#populate!Object



8
9
10
11
12
13
14
# File 'lib/discogs/wishlist/populators/wishlist_populator.rb', line 8

def populate!
  wantlist = discogs_api.fetch_by_username(wishlist.username)

  wantlist.each do |wantlist_item|
    wishlist.add_to_wishlist(wantlist_item)
  end
end