Sha256: bc504b5748646fb492f44d7c026bd72cc4e3cab3e65c5fd82fcb91239ad78cc1

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

module ItunesApi
  module Music
    module Requests
      # Allows querying the API via lookup for artists.
      class Artist
        include Request
        attr_reader_init :apple_id, :store
        selfie :find_by_apple_id

        def find_by_apple_id
          return nil unless results.any?

          Results::Artist.new(results.first, store)
        end

        private

        def action
          'lookup'
        end

        def query
          {
            id: apple_id,
            country: store.to_s.upcase,
            limit: LIMIT
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itunes_api-2.1.0 lib/itunes_api/music/requests/artist.rb
itunes_api-2.0.0 lib/itunes_api/music/requests/artist.rb