Class: ItunesApi::Music::Artist
- Inherits:
-
Object
- Object
- ItunesApi::Music::Artist
- Defined in:
- lib/itunes_api/music/artist.rb
Overview
Artist or Band from the Apple catalog
Class Method Summary collapse
- .all_apple_ids(name, store) ⇒ Object
- .find_all_by_name(name, store) ⇒ Object
- .find_by_apple_id(apple_id, store) ⇒ Object
Instance Method Summary collapse
Class Method Details
.all_apple_ids(name, store) ⇒ Object
8 9 10 |
# File 'lib/itunes_api/music/artist.rb', line 8 def all_apple_ids(name, store) find_all_by_name(name, store).map(&:apple_id) end |
.find_all_by_name(name, store) ⇒ Object
12 13 14 15 16 |
# File 'lib/itunes_api/music/artist.rb', line 12 def find_all_by_name(name, store) Requests::Search.artists(name, store).map do |result| new(*result.attributes) end end |
.find_by_apple_id(apple_id, store) ⇒ Object
18 19 20 21 |
# File 'lib/itunes_api/music/artist.rb', line 18 def find_by_apple_id(apple_id, store) artist = artist(apple_id, store) artist ? new(*artist.attributes) : nil end |
Instance Method Details
#albums ⇒ Object
30 31 32 |
# File 'lib/itunes_api/music/artist.rb', line 30 def albums @albums ||= Album.for_artist(apple_id, store) end |
#to_hash ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/itunes_api/music/artist.rb', line 34 def to_hash { amg_id: amg_id, apple_id: apple_id, genre: genre, link: link, name: name, store: store } end |