Class: Pushpop::Keen

Inherits:
Step
  • Object
show all
Defined in:
lib/pushpop-keen.rb,
lib/pushpop-keen/version.rb

Constant Summary collapse

PLUGIN_NAME =
'keen'
VERSION =
'0.3'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_analysesObject

Returns the value of attribute _analyses.



20
21
22
# File 'lib/pushpop-keen.rb', line 20

def _analyses
  @_analyses
end

#_analysis_typeObject

Returns the value of attribute _analysis_type.



13
14
15
# File 'lib/pushpop-keen.rb', line 13

def _analysis_type
  @_analysis_type
end

#_event_collectionObject

Returns the value of attribute _event_collection.



12
13
14
# File 'lib/pushpop-keen.rb', line 12

def _event_collection
  @_event_collection
end

#_filtersObject

Returns the value of attribute _filters.



18
19
20
# File 'lib/pushpop-keen.rb', line 18

def _filters
  @_filters
end

#_group_byObject

Returns the value of attribute _group_by.



16
17
18
# File 'lib/pushpop-keen.rb', line 16

def _group_by
  @_group_by
end

#_intervalObject

Returns the value of attribute _interval.



17
18
19
# File 'lib/pushpop-keen.rb', line 17

def _interval
  @_interval
end

#_max_ageObject

Returns the value of attribute _max_age.



21
22
23
# File 'lib/pushpop-keen.rb', line 21

def _max_age
  @_max_age
end

#_stepsObject

Returns the value of attribute _steps.



19
20
21
# File 'lib/pushpop-keen.rb', line 19

def _steps
  @_steps
end

#_target_propertyObject

Returns the value of attribute _target_property.



15
16
17
# File 'lib/pushpop-keen.rb', line 15

def _target_property
  @_target_property
end

#_timeframeObject

Returns the value of attribute _timeframe.



14
15
16
# File 'lib/pushpop-keen.rb', line 14

def _timeframe
  @_timeframe
end

Instance Method Details

#analyses(analyses) ⇒ Object



87
88
89
# File 'lib/pushpop-keen.rb', line 87

def analyses(analyses)
  self._analyses = analyses
end

#analysis_type(analysis_type) ⇒ Object



59
60
61
# File 'lib/pushpop-keen.rb', line 59

def analysis_type(analysis_type)
  self._analysis_type = analysis_type
end

#configure(last_response = nil, step_responses = nil) ⇒ Object



35
36
37
# File 'lib/pushpop-keen.rb', line 35

def configure(last_response=nil, step_responses=nil)
  self.instance_exec(last_response, step_responses, &block)
end

#event_collection(event_collection) ⇒ Object



55
56
57
# File 'lib/pushpop-keen.rb', line 55

def event_collection(event_collection)
  self._event_collection = event_collection
end

#filters(filters) ⇒ Object



79
80
81
# File 'lib/pushpop-keen.rb', line 79

def filters(filters)
  self._filters = filters
end

#group_by(group_by) ⇒ Object



71
72
73
# File 'lib/pushpop-keen.rb', line 71

def group_by(group_by)
  self._group_by = group_by
end

#interval(interval) ⇒ Object



75
76
77
# File 'lib/pushpop-keen.rb', line 75

def interval(interval)
  self._interval = interval
end

#max_age(max_age) ⇒ Object



91
92
93
# File 'lib/pushpop-keen.rb', line 91

def max_age(max_age)
  self._max_age = max_age
end

#record(name, properties) ⇒ Object



39
40
41
# File 'lib/pushpop-keen.rb', line 39

def record(name, properties)
  ::Keen.publish(name, properties)
end

#run(last_response = nil, step_responses = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pushpop-keen.rb', line 23

def run(last_response=nil, step_responses=nil)
  ret = self.configure(last_response, step_responses)

  if self._analysis_type == 'funnel'
    ::Keen.funnel(self.to_analysis_options)
  elsif !self._analysis_type.nil?
    ::Keen.send(self._analysis_type, self._event_collection, self.to_analysis_options)
  else
    ret
  end
end

#steps(steps) ⇒ Object



83
84
85
# File 'lib/pushpop-keen.rb', line 83

def steps(steps)
  self._steps = steps
end

#target_property(target_property) ⇒ Object



67
68
69
# File 'lib/pushpop-keen.rb', line 67

def target_property(target_property)
  self._target_property = target_property
end

#timeframe(timeframe) ⇒ Object



63
64
65
# File 'lib/pushpop-keen.rb', line 63

def timeframe(timeframe)
  self._timeframe = timeframe
end

#to_analysis_optionsObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pushpop-keen.rb', line 43

def to_analysis_options
  { timeframe: self._timeframe,
    target_property: self._target_property,
    group_by: self._group_by,
    interval: self._interval,
    filters: self._filters,
    analyses: self._analyses,
    max_age: self._max_age,
    steps: self._steps
  }.delete_if { |_, v| v.nil? }
end