Skip to Content Skip to Search
Methods
N
P

Constants

DEFAULT_PERIOD = :last_30_days
 
PERIODS = { all_time: 36500, last_365_days: 365, last_90_days: 90, last_30_days: 30, last_14_days: 14, last_7_days: 7 }.freeze
 

Attributes

[R] include_zero_views
[R] page
[R] per_page
[R] period
[R] site

Class Public methods

new(site, options = {})

# File app/services/service/analytics/base.rb, line 23
def initialize(site, options = {})
  @site = site
  @period = to_period(options[:period])
  @page = (options[:page].presence || 1).to_i
  @per_page = (options[:per_page].presence || ENV["PAGINATION_PER_PAGE"]).to_i
  @include_zero_views = options[:include_zero_views].presence
end

periods_for_select()

# File app/services/service/analytics/base.rb, line 18
def periods_for_select
  PERIODS.map { |period| [period[0].to_s.capitalize.humanize, period[0]] }.reverse
end