A class to represent the result hash of an Setlist search.
Takes the result ash and passes it to #parse_results
# File lib/songkickr/concert_setlist_result.rb, line 9 def initialize(result_hash = {}) if result_hash["resultsPage"] results_page = result_hash["resultsPage"] if results_page @results = parse_results results_page["results"] end else result_hash end end
Parses the setlist items into an array of SetlistItems
# File lib/songkickr/concert_setlist_result.rb, line 25 def parse_results(results = {}) setlists = [] if results.include?("setlist") results["setlist"].each do |setlist| setlists << Songkickr::Setlist.new(setlist) end end setlists end