Class: Octo::NotificationHit

Inherits:
Object
  • Object
show all
Extended by:
Counter, Scheduleable
Includes:
Cequel::Record
Defined in:
lib/octocore/models/enterprise/notification_hit.rb

Overview

Counters for notifications sent

Constant Summary

Constants included from Counter

Counter::COUNTER_KEY_PREFIX, Counter::INDEX_KEY_PREFIX, Counter::SEPARATOR, Counter::TYPE_DAY, Counter::TYPE_DAY_3, Counter::TYPE_DAY_6, Counter::TYPE_HOUR, Counter::TYPE_HOUR_12, Counter::TYPE_HOUR_3, Counter::TYPE_HOUR_6, Counter::TYPE_MINUTE, Counter::TYPE_MINUTE_30, Counter::TYPE_WEEK

Constants included from Counter::Helper

Counter::Helper::METHOD_PREFIX

Constants included from Cequel::Record

Cequel::Record::DUMP_ATTRS

Class Method Summary collapse

Methods included from Counter

aggregate, aggregate!, aggregate_and_create, call_completion_hook, countables, increment_for, local_count, local_counter_sum, update_counters

Methods included from Counter::Helper

counter_text, #generate_aggregators, #get_duration_for_counter_type, #get_fromtype_for_totype, #get_typecounters, #max_type, #method_names_type_counter, #string_to_const_val, #type_counters_method_names

Methods included from Scheduleable

perform

Methods included from Cequel::Record

#marshal_dump, #marshal_load, redis, update_cache_config

Class Method Details

.fakedata(args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/octocore/models/enterprise/notification_hit.rb', line 25

def self.fakedata(args)
  opts = {
    bod: false,
    step: 1.day
  }
  self.time_slots.concat([:ios, :android]).inject([]) do |res, uid|
    values = {
        count: rand(500..900),
      }
    _args = args.merge(uid: uid)
    res << self.fake_data_with(_args, values, opts)
    res.flatten
  end
end

.time_slotsObject



21
22
23
# File 'lib/octocore/models/enterprise/notification_hit.rb', line 21

def self.time_slots
  Array.new(6) { |i| "s_#{ i }" }
end