Class: FileDownloadStat

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Sufia::FileStatUtils
Defined in:
app/models/file_download_stat.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sufia::FileStatUtils

convert_date, to_flots

Class Method Details

.ga_statistics(start_date, file_id) ⇒ Object

Sufia::Download is sent to Sufia::Analytics.profile as #sufia__download see Legato::ProfileMethods.method_name_from_klass



14
15
16
# File 'app/models/file_download_stat.rb', line 14

def self.ga_statistics(start_date, file_id)
  Sufia::Analytics.profile.sufia__download(sort: 'date', start_date: start_date, end_date: Date.yesterday).for_file(file_id)
end

.statistics(file_id, start_date, user_id = nil) ⇒ Object



8
9
10
# File 'app/models/file_download_stat.rb', line 8

def self.statistics(file_id, start_date, user_id = nil)
  combined_stats file_id, start_date, :downloads, :totalEvents, user_id
end

Instance Method Details

#to_flotObject



4
5
6
# File 'app/models/file_download_stat.rb', line 4

def to_flot
  [self.class.convert_date(date), downloads]
end