Sha256: 6073704c92c3ab50d02ad715d8a335794cdd8a243824778c08eb931c36afb5d8

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 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 apple_id
          @apple_id ||= data['artistId']
        end

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

        def genre
          @genre ||= data['primaryGenreName']
        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

1 entries across 1 versions & 1 rubygems

Version Path
itunes_api-2.0.0 lib/itunes_api/music/results/artist.rb