sensor 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZmQzMzIzYjljOTBiZDExNmM4M2JmN2JiYjUwODUwMDUwZGFlOGMyNQ==
5
- data.tar.gz: !binary |-
6
- OTIwNzBmNjRiNjU5OGJiZjQwNmFiNzIxZTJmNDRmZDJjY2Y2MzI0ZA==
2
+ SHA1:
3
+ metadata.gz: 39ffb663cf150499631d3d040738047db623c03a
4
+ data.tar.gz: adf5bf58c3ae887860c1379124032827762311a4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODY3NjU2ODNjYmIwOTNjNjRkOTNhMTliYzc2MzA2MmI1NTc0OTZlMmY1OTIz
10
- NGZmNTM4MDY2ZjRmOGI2N2E1ZDcxNGY2ZWRjMTMyZmM4NmJmY2U0MGVmZDFi
11
- MWVhYjUxNWMzOGNkYTE3NDE1YTE3MWZmMTgwMzAyYjI3NzI0NzI=
12
- data.tar.gz: !binary |-
13
- OGVhYzc4NWYwZjZkOTIxOWE1Mzg5YTFlZjc4ZGRjOGNjY2EwMjQzZWUyYWNk
14
- MmQxOTVkMzhjNjYyZDczNzdlMTE2MjBhNmIwYmQzODBkNWRkZjkwYjdlOWRh
15
- ZDYwNWUyMDM5YzFlMjMxMjlhMTVhMWUyNmZkNGYzYWI4ZDIwYjc=
6
+ metadata.gz: 361884393d91aada2c7dd300ab9e1b4589277e27b3d2d41639a740522437fb8bfd85aefb7717be75a58ac8c12b7926c98a28b832f9bf72ff7571a4e7a71fffb7
7
+ data.tar.gz: 2f02dd8b136ca2f638a0ccb75724c3ff265338350ae3dfa240d3682663b9af057f397ffbc4c7d4ac0d38f76f06e0978f71fa324926f5fc8e284b645e8ed92434
@@ -1 +1 @@
1
- ruby-1.9.3
1
+ ruby-2.2.1
@@ -0,0 +1,36 @@
1
+ require 'slack-notifier'
2
+
3
+ module Sensor
4
+ module OutputDistribution
5
+ class Slack
6
+ def initialize(payload)
7
+ @payload = payload
8
+ end
9
+
10
+ def distribute
11
+ notifier.ping(content)
12
+ end
13
+
14
+ protected
15
+ def content
16
+ @payload.data.inject("") do |str, key_value|
17
+ str += "*#{key_value[0]}*\r\n"
18
+
19
+ key_value[1].each do |attribute, value|
20
+ str += " - *#{attribute}*: #{value}\r\n"
21
+ end
22
+ str
23
+ end
24
+ end
25
+
26
+ def notifier
27
+ @notifier ||= ::Slack::Notifier.new(
28
+ ENV['SLACK_WEBHOOK_URL'],
29
+ {
30
+ channel: ENV['SLACK_CHANNEL']
31
+ }
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
@@ -4,6 +4,7 @@ Sensor.require("analytics_retrieval")
4
4
  Sensor.require("twitter_retrieval")
5
5
  Sensor.require("facebook_retrieval")
6
6
  Sensor.require("flow_dock")
7
+ Sensor.require("slack")
7
8
 
8
9
  module Sensor
9
10
  class Payload
@@ -23,7 +24,11 @@ module Sensor
23
24
  end
24
25
 
25
26
  def distribute
26
- Sensor::OutputDistribution::FlowDock.new(self).distribute
27
+ if ENV['SLACK_WEBHOOK_URL']
28
+ Sensor::OutputDistribution::Slack.new(self).distribute
29
+ else
30
+ Sensor::OutputDistribution::FlowDock.new(self).distribute
31
+ end
27
32
  end
28
33
 
29
34
  def start_date
@@ -1,3 +1,3 @@
1
1
  module Sensor
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "twitter", "~> 5.0.0"
24
24
  spec.add_dependency "koala"
25
25
  spec.add_dependency "flowdock"
26
+ spec.add_dependency "slack-notifier"
26
27
  spec.add_dependency "rake"
27
28
  spec.add_dependency "oauth2"
28
29
 
metadata CHANGED
@@ -1,265 +1,279 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2015-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic
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: garb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.1
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.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: twitter
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 5.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 5.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: koala
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: flowdock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: slack-notifier
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ! '>='
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ! '>='
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: oauth2
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ! '>='
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ! '>='
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: bundler
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ~>
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
131
  version: '1.3'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ~>
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '1.3'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rspec
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ! '>='
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ! '>='
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: vcr
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ! '>='
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ! '>='
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: webmock
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ! '>='
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ! '>='
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: pry
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - ! '>='
185
+ - - ">="
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - ! '>='
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: timecop
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - ! '>='
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
201
  version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - ! '>='
206
+ - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: dotenv
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
- - - ! '>='
213
+ - - ">="
200
214
  - !ruby/object:Gem::Version
201
215
  version: '0'
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - ! '>='
220
+ - - ">="
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: sinatra
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
- - - ! '>='
227
+ - - ">="
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0'
216
230
  type: :development
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
- - - ! '>='
234
+ - - ">="
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0'
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: shotgun
225
239
  requirement: !ruby/object:Gem::Requirement
226
240
  requirements:
227
- - - ! '>='
241
+ - - ">="
228
242
  - !ruby/object:Gem::Version
229
243
  version: '0'
230
244
  type: :development
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
- - - ! '>='
248
+ - - ">="
235
249
  - !ruby/object:Gem::Version
236
250
  version: '0'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: omniauth-facebook
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
- - - ! '>='
255
+ - - ">="
242
256
  - !ruby/object:Gem::Version
243
257
  version: '0'
244
258
  type: :development
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
- - - ! '>='
262
+ - - ">="
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0'
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: omniauth-google-oauth2
253
267
  requirement: !ruby/object:Gem::Requirement
254
268
  requirements:
255
- - - ! '>='
269
+ - - ">="
256
270
  - !ruby/object:Gem::Version
257
271
  version: '0'
258
272
  type: :development
259
273
  prerelease: false
260
274
  version_requirements: !ruby/object:Gem::Requirement
261
275
  requirements:
262
- - - ! '>='
276
+ - - ">="
263
277
  - !ruby/object:Gem::Version
264
278
  version: '0'
265
279
  description: Sensor provides a set of marketing metrics
@@ -269,11 +283,11 @@ executables: []
269
283
  extensions: []
270
284
  extra_rdoc_files: []
271
285
  files:
272
- - .env.example
273
- - .gitignore
274
- - .rspec
275
- - .ruby-gemset
276
- - .ruby-version
286
+ - ".env.example"
287
+ - ".gitignore"
288
+ - ".rspec"
289
+ - ".ruby-gemset"
290
+ - ".ruby-version"
277
291
  - Gemfile
278
292
  - LICENSE.txt
279
293
  - README.md
@@ -286,6 +300,7 @@ files:
286
300
  - lib/sensor/actuator/twitter_retrieval.rb
287
301
  - lib/sensor/configuration.rb
288
302
  - lib/sensor/output_distribution/flow_dock.rb
303
+ - lib/sensor/output_distribution/slack.rb
289
304
  - lib/sensor/payload.rb
290
305
  - lib/sensor/rake_task.rb
291
306
  - lib/sensor/time_range.rb
@@ -309,17 +324,17 @@ require_paths:
309
324
  - lib
310
325
  required_ruby_version: !ruby/object:Gem::Requirement
311
326
  requirements:
312
- - - ! '>='
327
+ - - ">="
313
328
  - !ruby/object:Gem::Version
314
329
  version: '0'
315
330
  required_rubygems_version: !ruby/object:Gem::Requirement
316
331
  requirements:
317
- - - ! '>='
332
+ - - ">="
318
333
  - !ruby/object:Gem::Version
319
334
  version: '0'
320
335
  requirements: []
321
336
  rubyforge_project:
322
- rubygems_version: 2.2.2
337
+ rubygems_version: 2.4.5
323
338
  signing_key:
324
339
  specification_version: 4
325
340
  summary: Marketing Metrics Acquisition Tool