class Evvnt::Report

Public: Returns report for a given {Evvnt::Event} from the API.

Examples

Evvnt::Report.find(event_id: '...')

Public Instance Methods

show() click to toggle source

GET /events/:event_id/report View report data for my event

# File lib/evvnt/report.rb, line 16
define_action :show

Private Instance Methods

format_array_attribute(key, value) click to toggle source
# File lib/evvnt/report.rb, line 29
def format_array_attribute(key, value)
  case key
  when /^(clicks\_by\_day|broadcasts)$/
    send(:"format_#{key}_attribute", key, value)
  else
    super
  end
end
format_broadcasts_attribute(_key, value) click to toggle source
# File lib/evvnt/report.rb, line 46
def format_broadcasts_attribute(_key, value)
  Array(value).map { |atts| Evvnt::Broadcast.new(atts) }
end
format_clicks_by_day_attribute(_key, value) click to toggle source
# File lib/evvnt/report.rb, line 50
def format_clicks_by_day_attribute(_key, value)
  value.to_a[1..-1].map do |date, twitter, myspace, total|
    Evvnt::ClicksByDay.new(date: date, twitter: twitter,
                           myspace: myspace, total: total)
  end
end
format_hash_attribute(key, value) click to toggle source
Calls superclass method Evvnt::Attributes#format_hash_attribute
# File lib/evvnt/report.rb, line 20
def format_hash_attribute(key, value)
  case key
  when /^(referrers|search\_indexing)$/
    send(:"format_#{key}_attribute", key, value)
  else
    super
  end
end
format_referrers_attribute(_key, value) click to toggle source
# File lib/evvnt/report.rb, line 38
def format_referrers_attribute(_key, value)
  value.to_a.map { |url, count| Evvnt::Referrer.new(url: url, count: count) }
end
format_search_indexing_attribute(_key, value) click to toggle source
# File lib/evvnt/report.rb, line 42
def format_search_indexing_attribute(_key, value)
  value.to_a.map { |name, url| Evvnt::SearchIndexing.new(name: name, url: url) }
end