Class: Wishlist
- Inherits:
-
Object
- Object
- Wishlist
- Includes:
- Enumerable
- Defined in:
- lib/discogs/wishlist/models/wishlist.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #add_to_wishlist(item) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(username:, country:) ⇒ Wishlist
constructor
A new instance of Wishlist.
Constructor Details
#initialize(username:, country:) ⇒ Wishlist
Returns a new instance of Wishlist.
9 10 11 12 |
# File 'lib/discogs/wishlist/models/wishlist.rb', line 9 def initialize(username:, country:) @username = username @country = country end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
7 8 9 |
# File 'lib/discogs/wishlist/models/wishlist.rb', line 7 def country @country end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/discogs/wishlist/models/wishlist.rb', line 7 def username @username end |
Instance Method Details
#add_to_wishlist(item) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/discogs/wishlist/models/wishlist.rb', line 14 def add_to_wishlist(item) variation = AlbumVariation.new(item) album = get_album_from_variation(variation) album.add_variation(variation) wishlist.sort_by!(&:artist) end |
#each(&block) ⇒ Object
24 25 26 |
# File 'lib/discogs/wishlist/models/wishlist.rb', line 24 def each(&block) wishlist.each(&block) end |