class Commands::Wishlist

Attributes

country_code[R]
for_sale[R]
username[R]

Public Class Methods

new(username:, for_sale:, country_code:) click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 13
def initialize(username:, for_sale:, country_code:)
  @username = username
  @for_sale = for_sale
  @country_code = country_code
end

Public Instance Methods

perform() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 19
def perform
  suppress_output do
    populate_wishlist
    populate_items_for_sale if show_for_sale?
  end

  print_wishlist
end

Private Instance Methods

country() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 52
def country
  @country || begin
    return nil unless country_code

    ISO3166::Country.new(country_code)
  end
end
populate_items_for_sale() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 40
def populate_items_for_sale
  ItemsForSalePopulator.new(wishlist: wishlist).populate!
end
populate_wishlist() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 36
def populate_wishlist
  WishlistPopulator.new(wishlist: wishlist).populate!
end
print_wishlist() click to toggle source
show_for_sale?() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 48
def show_for_sale?
  for_sale && !!country
end
wishlist() click to toggle source
# File lib/discogs/wishlist/commands/wishlist.rb, line 44
def wishlist
  @wishlist ||= ::Wishlist.new(username: username, country: country)
end