Class: AppleMusic::StoreClient
Instance Method Summary
collapse
Methods inherited from Client
#get, #headers, #initialize, #post
Instance Method Details
#find_artist(artist_name:) ⇒ Object
10
11
12
13
|
# File 'lib/storeClient.rb', line 10
def find_artist(artist_name:)
response = get_catalog("search?term=#{escape(artist_name)}&types=artists")
parse(response.dig("results", "artists", "data"))[0]
end
|
#get_albums(artist:) ⇒ Object
20
21
22
23
|
# File 'lib/storeClient.rb', line 20
def get_albums(artist:)
response = PaginatedResponse.new(self, get("/v1/catalog/us/artists/#{artist.id}/albums?limit=100"))
parse(response).sort_by { |album| album.releaseDate }.reverse
end
|
#get_artist(artist_id:) ⇒ Object
15
16
17
18
|
# File 'lib/storeClient.rb', line 15
def get_artist(artist_id:)
response = get_catalog("artists/#{artist_id}")
parse(response["data"])[0]
end
|