class Songkickr::ConcertSetlistResult

A class to represent the result hash of an Setlist search.

www.songkick.com/developer/setlists

Attributes

results[RW]

Public Class Methods

new(result_hash = {}) click to toggle source

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

Protected Instance Methods

parse_results(results = {}) click to toggle source

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