Sha256: 3e7e0300ad7487ab24dd7ed6e8e18b97f4a214796c060aeb28da28fff48be905

Contents?: true

Size: 723 Bytes

Versions: 7

Compression:

Stored size: 723 Bytes

Contents

module Songkickr
  # A class to represent the result hash of a Tracking search.
  class TrackingResult
    attr_accessor :results

    # 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.
    def initialize(result_hash = {})
      results_page = result_hash["resultsPage"]

      if results_page
        @results = parse_results results_page["results"]
      end
    end

    protected

      # Take the results hash directly and parse the tracking into Tracking objects.
      #
      # Returns an array of Trackings.
      def parse_results(results = {})
        Songkickr::Tracking.new(results["tracking"])
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
songkickr-0.5.5 lib/songkickr/tracking_result.rb
songkickr-0.5.4 lib/songkickr/tracking_result.rb
songkickr-0.5.3 lib/songkickr/tracking_result.rb
songkickr-0.5.2 lib/songkickr/tracking_result.rb
songkickr-0.5.0 lib/songkickr/tracking_result.rb
songkickr-0.4.1 lib/songkickr/tracking_result.rb
songkickr-0.4.0 lib/songkickr/tracking_result.rb