Sha256: 2d9ba9d3676f9a215fab4e658a64de30f0dab8d09fc1a8a23a7bd4746072ef02

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

module Songkickr
  class ArtistResult
  	attr_accessor :page, :total_entries, :results

  	def initialize(result_hash = {})
  		results_page = result_hash["resultsPage"]

  		if results_page
  			@page 			= results_page["page"]
  			@total_entries	= results_page["totalEntries"]
  			@results 		= parse_results results_page["results"]
  		end
  	end

  	protected

  	def parse_results(results = {})
  		artists = []
  		if results.include?("artist")
  			results["artist"].each do |artist|
  				artists << Songkickr::Artist.new(artist)
  			end
  		end

  		artists
  	end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
songkickr-0.1.4 lib/songkickr/artist_result.rb
songkickr-0.1.3 lib/songkickr/artist_result.rb
songkickr-0.1.2 lib/songkickr/artist_result.rb
songkickr-0.1.1 lib/songkickr/artist_result.rb