Module: Hyrax::Analytics::Google::Events

Extended by:
Legato::Model
Defined in:
app/services/hyrax/analytics/google/events.rb

Class Method Summary collapse

Class Method Details

.list(profile, start_date, end_date, action) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'app/services/hyrax/analytics/google/events.rb', line 23

def self.list(profile, start_date, end_date, action)
  action = action.underscore
  results = []
  Events.results(profile,
    start_date: start_date,
    end_date: end_date,
    sort: ['-totalEvents']).send(action).each do |result|
      results.push([result.eventLabel, result.totalEvents.to_i])
    end
  results
end