pushpop-keen 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f99b446d23b1ca7d137d3975b44f0416d6c7181
4
- data.tar.gz: 3db767ef6814b271c2d7ea6641cffe1457e170d4
3
+ metadata.gz: b76cb926fd8fe661fc862fd055769473f844e7bd
4
+ data.tar.gz: 96571c39cf9191e6c54ebe1b73be0111d6dd2811
5
5
  SHA512:
6
- metadata.gz: c97d92e2f35d54f07fb0035b52afaf0e6a16597544ed1444cd505de453b6a03b44f29ac23bc52ffe3c8b005fabefcad9aaf10953faf6be193860031687c48089
7
- data.tar.gz: d884e5c7a1d2f963bcf80287c390227056f9cd0971cb0f1aa28d4761b123e4ee9e542115dc203b577b4dd0ffda85827b261479d833d0f059b2b690ad29047475
6
+ metadata.gz: 1889e66f20cb170e09b9fb2d2fd2fc89ef6a5e95cbb030dd28d7ff14976729c91ce780eb16ef3d188f7bd61b36ceb406bdd257236a91634cbd9f4de4c1a90d14
7
+ data.tar.gz: 2092041f9e0c8285acc17ee0b30e28663a5f9ee501949d79a577635cddefaa8b419b9390b35b70c7b585806a249caef1004bf938c3323992247c9657c42e0e4c
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'pushpop'
4
- gem 'keen'
4
+ gem 'keen', '>=0.9.2'
5
5
 
6
6
  group :development, :test do
7
7
  gem 'rake'
@@ -7,18 +7,18 @@ GEM
7
7
  minitest (~> 5.1)
8
8
  thread_safe (~> 0.1)
9
9
  tzinfo (~> 1.1)
10
- addressable (2.3.6)
10
+ addressable (2.3.8)
11
11
  clockwork (0.7.5)
12
12
  activesupport
13
13
  tzinfo
14
14
  diff-lcs (1.2.5)
15
15
  i18n (0.6.9)
16
16
  json (1.8.1)
17
- keen (0.8.2)
17
+ keen (0.9.2)
18
18
  addressable (~> 2.3.5)
19
19
  multi_json (~> 1.3)
20
20
  minitest (5.3.4)
21
- multi_json (1.10.1)
21
+ multi_json (1.11.2)
22
22
  pushpop (0.1.1)
23
23
  clockwork
24
24
  rake (10.3.2)
@@ -42,7 +42,7 @@ PLATFORMS
42
42
  ruby
43
43
 
44
44
  DEPENDENCIES
45
- keen
45
+ keen (>= 0.9.2)
46
46
  pushpop
47
47
  rake
48
48
  rspec
data/README.md CHANGED
@@ -33,7 +33,8 @@ job 'average response time for successful requests last month' do
33
33
  target_property 'request.duration'
34
34
  group_by 'check.name'
35
35
  interval 'daily'
36
- timeframe 'last_month',
36
+ timeframe 'last_month'
37
+ max_age '300', #cache the query for 5 minutes
37
38
  filters [{ property_name: "response.successful",
38
39
  operator: "eq",
39
40
  property_value: true }]
@@ -67,4 +68,4 @@ The `keen` plugin requires that the following environment variables are set:
67
68
 
68
69
  ### Contributing
69
70
 
70
- Code and documentation issues and pull requests are welcome.
71
+ Code, documentation issues, and pull requests welcome!
@@ -18,6 +18,7 @@ module Pushpop
18
18
  attr_accessor :_filters
19
19
  attr_accessor :_steps
20
20
  attr_accessor :_analyses
21
+ attr_accessor :_max_age
21
22
 
22
23
  def run(last_response=nil, step_responses=nil)
23
24
  ret = self.configure(last_response, step_responses)
@@ -46,6 +47,7 @@ module Pushpop
46
47
  interval: self._interval,
47
48
  filters: self._filters,
48
49
  analyses: self._analyses,
50
+ max_age: self._max_age,
49
51
  steps: self._steps
50
52
  }.delete_if { |_, v| v.nil? }
51
53
  end
@@ -86,6 +88,10 @@ module Pushpop
86
88
  self._analyses = analyses
87
89
  end
88
90
 
91
+ def max_age(max_age)
92
+ self._max_age = max_age
93
+ end
94
+
89
95
  end
90
96
 
91
97
  end
@@ -1,5 +1,5 @@
1
1
  module Pushpop
2
2
  class Keen
3
- VERSION = '0.2'
3
+ VERSION = '0.3'
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ describe Pushpop::Keen do
4
4
 
5
5
  describe '#configure' do
6
6
 
7
- it 'should set various params' do
7
+ it 'sets various params' do
8
8
 
9
9
  step = Pushpop::Keen.new do
10
10
  event_collection 'pageviews'
@@ -13,6 +13,7 @@ describe Pushpop::Keen do
13
13
  target_property 'trinkets'
14
14
  group_by 'referer'
15
15
  interval 'hourly'
16
+ max_age '300'
16
17
  filters [{ property_value: 'referer',
17
18
  operator: 'ne',
18
19
  property_value: 'yahoo.com' }]
@@ -23,22 +24,23 @@ describe Pushpop::Keen do
23
24
 
24
25
  step.configure
25
26
 
26
- step._event_collection.should == 'pageviews'
27
- step._analysis_type.should == 'count'
28
- step._timeframe.should == 'last_3_days'
29
- step._group_by.should == 'referer'
30
- step._interval.should == 'hourly'
31
- step._steps.should == [{
27
+ expect(step._event_collection).to eq('pageviews')
28
+ expect(step._analysis_type).to eq('count')
29
+ expect(step._timeframe).to eq('last_3_days')
30
+ expect(step._group_by).to eq('referer')
31
+ expect(step._interval).to eq('hourly')
32
+ expect(step._max_age).to eq('300')
33
+ expect(step._steps).to eq([{
32
34
  event_collection: 'pageviews',
33
35
  actor_property: 'user.id'
34
- }]
35
- step._analyses.should == [{ analysis_type: 'count' }]
36
+ }])
37
+ expect(step._analyses).to eq([{ analysis_type: 'count' }])
36
38
  end
37
39
 
38
40
  end
39
41
 
40
42
  describe '#record' do
41
- it 'should record an event with properties' do
43
+ it 'records an event with properties' do
42
44
  step = Pushpop::Keen.new do
43
45
  record 'Pageview', useragent: 'Chrome'
44
46
  end
@@ -49,21 +51,23 @@ describe Pushpop::Keen do
49
51
  end
50
52
 
51
53
  describe '#run' do
52
- it 'should run the query based on the analysis type' do
53
- Keen.stub(:count).with('pageviews', {
54
- timeframe: 'last_3_days'
55
- }).and_return(365)
54
+ it 'runs the query based on the analysis type' do
55
+ allow(Keen).to receive(:count) { 365 }
56
+ #Keen.stub(:count).with('pageviews', {
57
+ # timeframe: 'last_3_days'
58
+ #}).and_return(365)
56
59
 
57
60
  step = Pushpop::Keen.new('one') do
58
61
  event_collection 'pageviews'
59
62
  analysis_type 'count'
60
63
  timeframe 'last_3_days'
61
64
  end
65
+
62
66
  response = step.run
63
- response.should == 365
67
+ expect(response).to eq(365)
64
68
  end
65
69
 
66
- it 'should not try to run a query if the analysis type isnt set' do
70
+ it 'don\'t run a query if the analysis type isnt set' do
67
71
  step = Pushpop::Keen.new do
68
72
  group_by 'something'
69
73
  end
@@ -74,7 +78,7 @@ describe Pushpop::Keen do
74
78
  step.run
75
79
  end
76
80
 
77
- it 'should run funnels directly, instead of using send' do
81
+ it 'run funnels directly, instead of using send' do
78
82
  step = Pushpop::Keen.new('one') do
79
83
  analysis_type 'funnel'
80
84
  steps [
@@ -99,7 +103,7 @@ describe Pushpop::Keen do
99
103
  end
100
104
 
101
105
  describe '#to_analysis_options' do
102
- it 'should include various options' do
106
+ it 'includes various options' do
103
107
  step = Pushpop::Keen.new('one') do end
104
108
  step._timeframe = 'last_4_days'
105
109
  step._group_by = 'referer'
@@ -111,7 +115,8 @@ describe Pushpop::Keen do
111
115
  step._steps = [{ event_collection: 'pageviews',
112
116
  actor_property: 'user.id' }]
113
117
  step._analyses = [{ analysis_type: 'count' }]
114
- step.to_analysis_options.should == {
118
+
119
+ expect(step.to_analysis_options).to eq({
115
120
  timeframe: 'last_4_days',
116
121
  target_property: 'trinkets',
117
122
  group_by: 'referer',
@@ -122,12 +127,12 @@ describe Pushpop::Keen do
122
127
  steps: [{ event_collection: 'pageviews',
123
128
  actor_property: 'user.id' }],
124
129
  analyses: [{ analysis_type: 'count' }]
125
- }
130
+ })
126
131
  end
127
132
 
128
- it 'should not include nils' do
133
+ it 'doesn\'t include nils' do
129
134
  step = Pushpop::Keen.new('one') do end
130
- step.to_analysis_options.should == {}
135
+ expect(step.to_analysis_options).to eq({})
131
136
  end
132
137
  end
133
138
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushpop-keen
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Dzielak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pushpop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: keen
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description:
@@ -44,7 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - .travis.yml
47
+ - ".travis.yml"
48
48
  - Gemfile
49
49
  - Gemfile.lock
50
50
  - LICENSE
@@ -64,17 +64,17 @@ require_paths:
64
64
  - lib
65
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.0.14
77
+ rubygems_version: 2.2.2
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Pushpop Keen IO plugin for querying and recording events