Sha256: e3e62f37d5c9728317764a9de124588e91c807d27f1ff1f84e1c30a403ef4393

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

require "peachy"

module Sevendigital

  class ArtistManager < Manager

     def get_details(id)
        api_request = Sevendigital::ApiRequest.new("artist/details", {:artistId => id})
        api_response = @api_client.operator.call_api(api_request)
        @api_client.artist_digestor.from_xml(api_response.content.artist)
      end

      def get_releases(id, options={})
        api_request = Sevendigital::ApiRequest.new("artist/releases", {:artistId => id}, options)
        api_response = @api_client.operator.call_api(api_request)
        @api_client.release_digestor.list_from_xml(api_response.content.releases)
      end
      
      def get_top_tracks(id, options={})
        api_request = Sevendigital::ApiRequest.new("artist/toptracks", {:artistId => id}, options)
        api_response = @api_client.operator.call_api(api_request)
        @api_client.track_digestor.list_from_xml(api_response.content.tracks)
      end

      def get_similar(id, options={})
        api_request = Sevendigital::ApiRequest.new("artist/similar", {:artistId => id}, options)
        api_response = @api_client.operator.call_api(api_request)
        @api_client.artist_digestor.list_from_xml(api_response.content.artists)
      end

      def get_top_by_tag(tags, options={})
        api_request = Sevendigital::ApiRequest.new("artist/byTag/top", {:tags => tags}, options)
        api_response = @api_client.operator.call_api(api_request)
        @api_client.artist_digestor.nested_list_from_xml(api_response.content.tagged_results, :tagged_item, :tagged_results)
      end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
7digital-0.0.1 lib/sevendigital/management/artist_manager.rb