Parent

Songkickr::EventResult

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

Attributes

page[RW]
results[RW]
total_entries[RW]

Public Class Methods

new(result_hash = {}) click to toggle source

Takes the result hash directly and parses out the page and total entries and finally passes off to the parse_results method to get the results.

# File lib/songkickr/event_result.rb, line 7
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 Instance Methods

parse_results(results = {}) click to toggle source
# File lib/songkickr/event_result.rb, line 20
def parse_results(results = {})
  events = []
  if results.include?("event")
    results["event"].each do |event|
      events << Songkickr::Event.new(event)
    end
  end
  
  events
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.