class Github::Archive::Event
Public Class Methods
create_with_json(raw_json)
click to toggle source
# File lib/github/archive/event.rb, line 8 def create_with_json(raw_json) json = raw_json.with_indifferent_access if related_event?(json[:type]) url = "UNKNOWN" if json[:repo] url = json[:repo][:url] elsif json[:repository] url = json[:repository][:url] end self.create( url: url, event_type: json[:type], gh_created_at: json[:created_at] ) end end
results_for_range_and_type(range, type, limit)
click to toggle source
# File lib/github/archive/event.rb, line 28 def results_for_range_and_type(range, type, limit) self.in_time_range(range) .with_event_type(type) .group(:url) .limit(limit) .order('count(*) DESC') .count(:url) end