Sha256: fe1176d49a12ebac5ddaf256fe83160a3fa127cc6135148b81828983db595c9c

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

module ItunesApi
  module Music
    module Results
      # Wrapper for artist search results.
      class Artist
        attr_reader_init :data, :store, search_term: nil
        private :data, :search_term

        def amg_id
          @amg_id ||= data['amgArtistId']
        end

        def apple_id
          @apple_id ||= data['artistId']
        end

        def attributes
          [amg_id, apple_id, genre, link, name, store]
        end

        def genre
          @genre ||= data['primaryGenreName']
        end

        def link
          @link ||= data['artistLinkUrl']
        end

        def name
          @name ||= data['artistName']
        end

        def relevant?
          return true unless search_term

          name.downcase.include?(search_term.downcase)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itunes_api-2.3.1 lib/itunes_api/music/results/artist.rb
itunes_api-2.3.0 lib/itunes_api/music/results/artist.rb
itunes_api-2.2.1 lib/itunes_api/music/results/artist.rb
itunes_api-2.2.0 lib/itunes_api/music/results/artist.rb
itunes_api-2.1.0 lib/itunes_api/music/results/artist.rb