Class: Github::Archive::Event
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Github::Archive::Event
- Defined in:
- lib/github/archive/event.rb
Class Method Summary collapse
Class Method Details
.create_with_json(raw_json) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/github/archive/event.rb', line 8 def create_with_json(raw_json) json = raw_json.with_indifferent_access if (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) ⇒ Object
28 29 30 31 32 33 34 35 |
# 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 |