Sha256: ff29177d90efd1c989e865b792b9fa3f6cbb4fafbb43d010ec321ab030e359be
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
module ItunesApi module Music # Artist or Band from the Apple catalog class Artist attr_reader_init :apple_id, :genre, :name, :store class << self def all_apple_ids(name, store) find_all_by_name(name, store).map(&:apple_id) end def find_all_by_name(name, store) Requests::Search.artists(name, store).map do |result| new(*result.attributes) end end def find_by_apple_id(apple_id, store) artist = artist(apple_id, store) artist ? new(*artist.attributes) : nil end private def artist(apple_id, store) Requests::Artist.find_by_apple_id(apple_id, store) end end def albums @albums ||= Album.for_artist(apple_id, store) end def to_hash { apple_id: apple_id, name: name, store: store } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
itunes_api-2.0.0 | lib/itunes_api/music/artist.rb |