brainzz 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +176 -0
- data/lib/brainzz.rb +29 -0
- data/lib/brainzz/commands/annotations_clickable_by_day_command.rb +7 -0
- data/lib/brainzz/commands/annotations_clickable_totals_command.rb +15 -0
- data/lib/brainzz/commands/annotations_clicked_by_day_command.rb +7 -0
- data/lib/brainzz/commands/annotations_clicked_totals_command.rb +15 -0
- data/lib/brainzz/commands/comment_count_by_day_command.rb +7 -0
- data/lib/brainzz/commands/comment_totals_command.rb +15 -0
- data/lib/brainzz/commands/dislike_count_by_day_command.rb +2 -11
- data/lib/brainzz/commands/like_count_by_day_command.rb +2 -11
- data/lib/brainzz/commands/share_count_by_day_command.rb +2 -11
- data/lib/brainzz/commands/subscribers_gained_by_day_command.rb +7 -0
- data/lib/brainzz/commands/subscribers_gained_totals_command.rb +15 -0
- data/lib/brainzz/commands/subscribers_lost_by_day_command.rb +7 -0
- data/lib/brainzz/commands/subscribers_lost_totals_command.rb +15 -0
- data/lib/brainzz/commands/video_stats_by_day_command.rb +12 -0
- data/lib/brainzz/commands/view_count_by_day_command.rb +2 -1
- data/lib/brainzz/commands/view_duration_totals_command.rb +15 -0
- data/lib/brainzz/commands/view_durations_by_day_command.rb +7 -0
- data/lib/brainzz/commands/view_percentage_totals_command.rb +15 -0
- data/lib/brainzz/commands/view_percentages_by_day_command.rb +7 -0
- data/lib/brainzz/core.rb +56 -0
- data/lib/brainzz/factories.rb +7 -0
- data/lib/brainzz/factories/annotations_clickable_count.rb +15 -0
- data/lib/brainzz/factories/annotations_clicked_count.rb +15 -0
- data/lib/brainzz/factories/comment_count.rb +14 -0
- data/lib/brainzz/factories/dislike_count.rb +2 -2
- data/lib/brainzz/factories/like_count.rb +2 -2
- data/lib/brainzz/factories/subscribers_gained_count.rb +15 -0
- data/lib/brainzz/factories/subscribers_lost_count.rb +15 -0
- data/lib/brainzz/factories/view_duration.rb +14 -0
- data/lib/brainzz/factories/view_percentage.rb +14 -0
- data/lib/brainzz/models/annotations_clickable_count.rb +18 -0
- data/lib/brainzz/models/annotations_clicked_count.rb +17 -0
- data/lib/brainzz/models/comment_count.rb +17 -0
- data/lib/brainzz/models/dislike_count.rb +1 -1
- data/lib/brainzz/models/like_count.rb +1 -1
- data/lib/brainzz/models/share_count.rb +1 -1
- data/lib/brainzz/models/subscribers_gained_count.rb +17 -0
- data/lib/brainzz/models/subscribers_lost_count.rb +17 -0
- data/lib/brainzz/models/view_duration.rb +18 -0
- data/lib/brainzz/models/view_percentage.rb +22 -0
- data/lib/brainzz/responses/annotations_clickable_response.rb +5 -0
- data/lib/brainzz/responses/annotations_clicked_response.rb +5 -0
- data/lib/brainzz/responses/comment_count_response.rb +5 -0
- data/lib/brainzz/responses/subscribers_gained_response.rb +5 -0
- data/lib/brainzz/responses/subscribers_lost_response.rb +5 -0
- data/lib/brainzz/responses/view_duration_response.rb +5 -0
- data/lib/brainzz/responses/view_percentage_response.rb +5 -0
- metadata +38 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efd20c526d7209efbeeae0f353ea0ab22aaf41ce
|
4
|
+
data.tar.gz: af768d8f3504b16fe18b926d3333dd8a5966626b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb83f12a28b483bd2f4b4ac4c6382971b110b8c90a9a4e5dd2ddb24574d29d9c7d71e439241dc1e41cc9d19b08630a4c4105104b1d1ccd5247937c201d6d62b5
|
7
|
+
data.tar.gz: 705e8be75d0921872871e8c75ee3880145315e7b36df335e278cfa20b1386c962ac2289c54fff1c4beb94dc00de8fb3ed43bd91da9318aefea6aa693409decee
|
data/README.md
CHANGED
@@ -184,6 +184,182 @@ Same as shares_by_day_for except date values are nil.
|
|
184
184
|
|
185
185
|
Shares for date range are aggregated.
|
186
186
|
|
187
|
+
### dislikes_by_day_for
|
188
|
+
|
189
|
+
#### Parameters
|
190
|
+
|
191
|
+
* video id (String)
|
192
|
+
* start date (DateTime)
|
193
|
+
* end date (DateTime)
|
194
|
+
|
195
|
+
#### Result
|
196
|
+
|
197
|
+
An array of `Brainzz::DislikeCount` objects ordered by date in ascending order.
|
198
|
+
|
199
|
+
### dislike_totals_for
|
200
|
+
|
201
|
+
#### Parameters
|
202
|
+
Same as dislikes_by_day_for.
|
203
|
+
|
204
|
+
#### Result
|
205
|
+
Same as dislikes_by_day_for except date values are nil.
|
206
|
+
|
207
|
+
Dislikes for date range are aggregated.
|
208
|
+
|
209
|
+
### comments_by_day_for
|
210
|
+
|
211
|
+
#### Parameters
|
212
|
+
|
213
|
+
* video id (String)
|
214
|
+
* start date (DateTime)
|
215
|
+
* end date (DateTime)
|
216
|
+
|
217
|
+
#### Result
|
218
|
+
|
219
|
+
An array of `Brainzz::CommentCount` objects ordered by date in ascending order.
|
220
|
+
|
221
|
+
### comment_totals_for
|
222
|
+
|
223
|
+
#### Parameters
|
224
|
+
Same as comments_by_day_for.
|
225
|
+
|
226
|
+
#### Result
|
227
|
+
Same as comments_by_day_for except date values are nil.
|
228
|
+
|
229
|
+
Comments for date range are aggregated.
|
230
|
+
|
231
|
+
### subscribers_gained_by_day_for
|
232
|
+
|
233
|
+
#### Parameters
|
234
|
+
|
235
|
+
* video id (String)
|
236
|
+
* start date (DateTime)
|
237
|
+
* end date (DateTime)
|
238
|
+
|
239
|
+
#### Result
|
240
|
+
|
241
|
+
An array of `Brainzz::SubscribersGainedCount` objects ordered by date in ascending order.
|
242
|
+
|
243
|
+
### subscribers_gained_totals_for
|
244
|
+
|
245
|
+
#### Parameters
|
246
|
+
Same as subscribers_gained_by_day_for.
|
247
|
+
|
248
|
+
#### Result
|
249
|
+
Same as subscribers_gained_by_day_for except date values are nil.
|
250
|
+
|
251
|
+
SubscribersGained for date range are aggregated.
|
252
|
+
|
253
|
+
### subscribers_lost_by_day_for
|
254
|
+
|
255
|
+
#### Parameters
|
256
|
+
|
257
|
+
* video id (String)
|
258
|
+
* start date (DateTime)
|
259
|
+
* end date (DateTime)
|
260
|
+
|
261
|
+
#### Result
|
262
|
+
|
263
|
+
An array of `Brainzz::SubscribersLostCount` objects ordered by date in ascending order.
|
264
|
+
|
265
|
+
### subscribers_lost_totals_for
|
266
|
+
|
267
|
+
#### Parameters
|
268
|
+
Same as subscribers_lost_by_day_for.
|
269
|
+
|
270
|
+
#### Result
|
271
|
+
Same as subscribers_lost_by_day_for except date values are nil.
|
272
|
+
|
273
|
+
SubscribersLost for date range are aggregated.
|
274
|
+
|
275
|
+
### annotations_clickable_by_day_for
|
276
|
+
|
277
|
+
#### Parameters
|
278
|
+
|
279
|
+
* video id (String)
|
280
|
+
* start date (DateTime)
|
281
|
+
* end date (DateTime)
|
282
|
+
|
283
|
+
#### Result
|
284
|
+
|
285
|
+
An array of `Brainzz::AnnotationsClickableCount` objects ordered by date in ascending order.
|
286
|
+
|
287
|
+
### annotations_clickable_totals_for
|
288
|
+
|
289
|
+
#### Parameters
|
290
|
+
Same as annotations_clickable_by_day_for.
|
291
|
+
|
292
|
+
#### Result
|
293
|
+
Same as annotations_clickable_by_day_for except date values are nil.
|
294
|
+
|
295
|
+
AnnotationsClickable for date range are aggregated.
|
296
|
+
|
297
|
+
### annotations_clicked_by_day_for
|
298
|
+
|
299
|
+
#### Parameters
|
300
|
+
|
301
|
+
* video id (String)
|
302
|
+
* start date (DateTime)
|
303
|
+
* end date (DateTime)
|
304
|
+
|
305
|
+
#### Result
|
306
|
+
|
307
|
+
An array of `Brainzz::AnnotationsClickedCount` objects ordered by date in ascending order.
|
308
|
+
|
309
|
+
### annotations_clicked_totals_for
|
310
|
+
|
311
|
+
#### Parameters
|
312
|
+
Same as annotations_clicked_by_day_for.
|
313
|
+
|
314
|
+
#### Result
|
315
|
+
Same as annotations_clicked_by_day_for except date values are nil.
|
316
|
+
|
317
|
+
AnnotationsClicked for date range are aggregated.
|
318
|
+
|
319
|
+
### view_percentages_by_day_for
|
320
|
+
|
321
|
+
#### Parameters
|
322
|
+
|
323
|
+
* video id (String)
|
324
|
+
* start date (DateTime)
|
325
|
+
* end date (DateTime)
|
326
|
+
|
327
|
+
#### Result
|
328
|
+
|
329
|
+
An array of `Brainzz::ViewPercentage` objects ordered by date in ascending order.
|
330
|
+
|
331
|
+
### view_percentage_totals_for
|
332
|
+
|
333
|
+
#### Parameters
|
334
|
+
Same as view_percentages_by_day_for.
|
335
|
+
|
336
|
+
#### Result
|
337
|
+
Same as view_percentages_by_day_for except date values are nil.
|
338
|
+
|
339
|
+
ViewPercentages for date range are aggregated.
|
340
|
+
|
341
|
+
### view_durations_by_day_for
|
342
|
+
|
343
|
+
#### Parameters
|
344
|
+
|
345
|
+
* video id (String)
|
346
|
+
* start date (DateTime)
|
347
|
+
* end date (DateTime)
|
348
|
+
|
349
|
+
#### Result
|
350
|
+
|
351
|
+
An array of `Brainzz::ViewDuration` objects ordered by date in ascending order.
|
352
|
+
|
353
|
+
### view_duration_totals_for
|
354
|
+
|
355
|
+
#### Parameters
|
356
|
+
Same as view_durations_by_day_for.
|
357
|
+
|
358
|
+
#### Result
|
359
|
+
Same as view_durations_by_day_for except date values are nil.
|
360
|
+
|
361
|
+
ViewDurations for date range are aggregated.
|
362
|
+
|
187
363
|
Factories
|
188
364
|
---------
|
189
365
|
|
data/lib/brainzz.rb
CHANGED
@@ -15,6 +15,13 @@ require_relative 'brainzz/models/view_count'
|
|
15
15
|
require_relative 'brainzz/models/like_count'
|
16
16
|
require_relative 'brainzz/models/share_count'
|
17
17
|
require_relative 'brainzz/models/dislike_count'
|
18
|
+
require_relative 'brainzz/models/comment_count'
|
19
|
+
require_relative 'brainzz/models/subscribers_gained_count'
|
20
|
+
require_relative 'brainzz/models/subscribers_lost_count'
|
21
|
+
require_relative 'brainzz/models/annotations_clickable_count'
|
22
|
+
require_relative 'brainzz/models/annotations_clicked_count'
|
23
|
+
require_relative 'brainzz/models/view_percentage'
|
24
|
+
require_relative 'brainzz/models/view_duration'
|
18
25
|
require_relative 'brainzz/models/playlist_item'
|
19
26
|
require_relative 'brainzz/models/playlist_items_wrapper'
|
20
27
|
|
@@ -33,6 +40,13 @@ require_relative 'brainzz/responses/view_count_response'
|
|
33
40
|
require_relative 'brainzz/responses/like_count_response'
|
34
41
|
require_relative 'brainzz/responses/share_count_response'
|
35
42
|
require_relative 'brainzz/responses/dislike_count_response'
|
43
|
+
require_relative 'brainzz/responses/comment_count_response'
|
44
|
+
require_relative 'brainzz/responses/subscribers_gained_response'
|
45
|
+
require_relative 'brainzz/responses/subscribers_lost_response'
|
46
|
+
require_relative 'brainzz/responses/annotations_clickable_response'
|
47
|
+
require_relative 'brainzz/responses/annotations_clicked_response'
|
48
|
+
require_relative 'brainzz/responses/view_percentage_response'
|
49
|
+
require_relative 'brainzz/responses/view_duration_response'
|
36
50
|
|
37
51
|
require_relative 'brainzz/commands/base_command'
|
38
52
|
require_relative 'brainzz/commands/data_command'
|
@@ -40,6 +54,7 @@ require_relative 'brainzz/commands/playlist_items_command'
|
|
40
54
|
require_relative 'brainzz/commands/video_details_command'
|
41
55
|
require_relative 'brainzz/commands/analytics_command'
|
42
56
|
require_relative 'brainzz/commands/video_stats_command'
|
57
|
+
require_relative 'brainzz/commands/video_stats_by_day_command'
|
43
58
|
require_relative 'brainzz/commands/view_totals_command'
|
44
59
|
require_relative 'brainzz/commands/view_count_by_day_command'
|
45
60
|
require_relative 'brainzz/commands/like_totals_command'
|
@@ -48,6 +63,20 @@ require_relative 'brainzz/commands/share_totals_command'
|
|
48
63
|
require_relative 'brainzz/commands/share_count_by_day_command'
|
49
64
|
require_relative 'brainzz/commands/dislike_totals_command'
|
50
65
|
require_relative 'brainzz/commands/dislike_count_by_day_command'
|
66
|
+
require_relative 'brainzz/commands/comment_totals_command'
|
67
|
+
require_relative 'brainzz/commands/comment_count_by_day_command'
|
68
|
+
require_relative 'brainzz/commands/subscribers_gained_totals_command'
|
69
|
+
require_relative 'brainzz/commands/subscribers_gained_by_day_command'
|
70
|
+
require_relative 'brainzz/commands/subscribers_lost_totals_command'
|
71
|
+
require_relative 'brainzz/commands/subscribers_lost_by_day_command'
|
72
|
+
require_relative 'brainzz/commands/annotations_clickable_totals_command'
|
73
|
+
require_relative 'brainzz/commands/annotations_clickable_by_day_command'
|
74
|
+
require_relative 'brainzz/commands/annotations_clicked_totals_command'
|
75
|
+
require_relative 'brainzz/commands/annotations_clicked_by_day_command'
|
76
|
+
require_relative 'brainzz/commands/view_percentage_totals_command'
|
77
|
+
require_relative 'brainzz/commands/view_percentages_by_day_command'
|
78
|
+
require_relative 'brainzz/commands/view_duration_totals_command'
|
79
|
+
require_relative 'brainzz/commands/view_durations_by_day_command'
|
51
80
|
|
52
81
|
require_relative 'brainzz/core'
|
53
82
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class AnnotationsClickableTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response AnnotationsClickableResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'annotationClickableImpressions',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class AnnotationsClickedTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response AnnotationsClickedResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'annotationClicks',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,16 +1,7 @@
|
|
1
1
|
module Brainzz
|
2
2
|
class DislikeCountByDayCommand < DislikeTotalsCommand
|
3
|
-
|
4
|
-
|
5
|
-
class << self
|
6
|
-
private
|
3
|
+
extend VideoStatsByDayCommand
|
7
4
|
|
8
|
-
|
9
|
-
super.merge({
|
10
|
-
'dimensions' => 'day',
|
11
|
-
'sort' => 'day',
|
12
|
-
})
|
13
|
-
end
|
14
|
-
end
|
5
|
+
make_with_response DislikeCountResponse
|
15
6
|
end
|
16
7
|
end
|
@@ -1,16 +1,7 @@
|
|
1
1
|
module Brainzz
|
2
2
|
class LikeCountByDayCommand < LikeTotalsCommand
|
3
|
-
|
4
|
-
|
5
|
-
class << self
|
6
|
-
private
|
3
|
+
extend VideoStatsByDayCommand
|
7
4
|
|
8
|
-
|
9
|
-
super.merge({
|
10
|
-
'dimensions' => 'day',
|
11
|
-
'sort' => 'day',
|
12
|
-
})
|
13
|
-
end
|
14
|
-
end
|
5
|
+
make_with_response LikeCountResponse
|
15
6
|
end
|
16
7
|
end
|
@@ -1,16 +1,7 @@
|
|
1
1
|
module Brainzz
|
2
2
|
class ShareCountByDayCommand < ShareTotalsCommand
|
3
|
-
|
4
|
-
|
5
|
-
class << self
|
6
|
-
private
|
3
|
+
extend VideoStatsByDayCommand
|
7
4
|
|
8
|
-
|
9
|
-
super.merge({
|
10
|
-
'dimensions' => 'day',
|
11
|
-
'sort' => 'day',
|
12
|
-
})
|
13
|
-
end
|
14
|
-
end
|
5
|
+
make_with_response ShareCountResponse
|
15
6
|
end
|
16
7
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class SubscribersGainedTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response SubscribersGainedResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'subscribersGained',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class SubscribersLostTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response SubscribersLostResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'subscribersLost',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Brainzz
|
2
2
|
class ViewCountByDayCommand < ViewTotalsCommand
|
3
|
+
extend VideoStatsByDayCommand
|
4
|
+
|
3
5
|
make_with_response ViewCountResponse
|
4
6
|
|
5
7
|
class << self
|
@@ -8,7 +10,6 @@ module Brainzz
|
|
8
10
|
def params(video_stats_params)
|
9
11
|
super.merge({
|
10
12
|
'dimensions' => 'day,insightTrafficSourceType',
|
11
|
-
'sort' => 'day',
|
12
13
|
})
|
13
14
|
end
|
14
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class ViewDurationTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response ViewDurationResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'averageViewDuration',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class ViewPercentageTotalsCommand < VideoStatsCommand
|
3
|
+
make_with_response ViewPercentageResponse
|
4
|
+
|
5
|
+
class << self
|
6
|
+
private
|
7
|
+
|
8
|
+
def params(video_stats_params)
|
9
|
+
super.merge({
|
10
|
+
'metrics' => 'averageViewPercentage',
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/brainzz/core.rb
CHANGED
@@ -41,5 +41,61 @@ module Brainzz
|
|
41
41
|
def dislike_totals_for(video_id, start_date, end_date)
|
42
42
|
DislikeTotalsCommand.execute video_id, start_date, end_date
|
43
43
|
end
|
44
|
+
|
45
|
+
def comments_by_day_for(video_id, start_date, end_date)
|
46
|
+
CommentCountByDayCommand.execute video_id, start_date, end_date
|
47
|
+
end
|
48
|
+
|
49
|
+
def comment_totals_for(video_id, start_date, end_date)
|
50
|
+
CommentTotalsCommand.execute video_id, start_date, end_date
|
51
|
+
end
|
52
|
+
|
53
|
+
def subscribers_gained_by_day_for(video_id, start_date, end_date)
|
54
|
+
SubscribersGainedByDayCommand.execute video_id, start_date, end_date
|
55
|
+
end
|
56
|
+
|
57
|
+
def subscribers_gained_totals_for(video_id, start_date, end_date)
|
58
|
+
SubscribersGainedTotalsCommand.execute video_id, start_date, end_date
|
59
|
+
end
|
60
|
+
|
61
|
+
def subscribers_lost_by_day_for(video_id, start_date, end_date)
|
62
|
+
SubscribersLostByDayCommand.execute video_id, start_date, end_date
|
63
|
+
end
|
64
|
+
|
65
|
+
def subscribers_lost_totals_for(video_id, start_date, end_date)
|
66
|
+
SubscribersLostTotalsCommand.execute video_id, start_date, end_date
|
67
|
+
end
|
68
|
+
|
69
|
+
def annotations_clickable_by_day_for(video_id, start_date, end_date)
|
70
|
+
AnnotationsClickableByDayCommand.execute video_id, start_date, end_date
|
71
|
+
end
|
72
|
+
|
73
|
+
def annotations_clickable_totals_for(video_id, start_date, end_date)
|
74
|
+
AnnotationsClickableTotalsCommand.execute video_id, start_date, end_date
|
75
|
+
end
|
76
|
+
|
77
|
+
def annotations_clicked_by_day_for(video_id, start_date, end_date)
|
78
|
+
AnnotationsClickedByDayCommand.execute video_id, start_date, end_date
|
79
|
+
end
|
80
|
+
|
81
|
+
def annotations_clicked_totals_for(video_id, start_date, end_date)
|
82
|
+
AnnotationsClickedTotalsCommand.execute video_id, start_date, end_date
|
83
|
+
end
|
84
|
+
|
85
|
+
def view_percentages_by_day_for(video_id, start_date, end_date)
|
86
|
+
ViewPercentagesByDayCommand.execute video_id, start_date, end_date
|
87
|
+
end
|
88
|
+
|
89
|
+
def view_percentage_totals_for(video_id, start_date, end_date)
|
90
|
+
ViewPercentageTotalsCommand.execute video_id, start_date, end_date
|
91
|
+
end
|
92
|
+
|
93
|
+
def view_durations_by_day_for(video_id, start_date, end_date)
|
94
|
+
ViewDurationsByDayCommand.execute video_id, start_date, end_date
|
95
|
+
end
|
96
|
+
|
97
|
+
def view_duration_totals_for(video_id, start_date, end_date)
|
98
|
+
ViewDurationTotalsCommand.execute video_id, start_date, end_date
|
99
|
+
end
|
44
100
|
end
|
45
101
|
end
|
data/lib/brainzz/factories.rb
CHANGED
@@ -6,3 +6,10 @@ require_relative 'factories/view_count'
|
|
6
6
|
require_relative 'factories/like_count'
|
7
7
|
require_relative 'factories/share_count'
|
8
8
|
require_relative 'factories/dislike_count'
|
9
|
+
require_relative 'factories/comment_count'
|
10
|
+
require_relative 'factories/subscribers_gained_count'
|
11
|
+
require_relative 'factories/subscribers_lost_count'
|
12
|
+
require_relative 'factories/annotations_clickable_count'
|
13
|
+
require_relative 'factories/annotations_clicked_count'
|
14
|
+
require_relative 'factories/view_percentage'
|
15
|
+
require_relative 'factories/view_duration'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_annotations_clickable_count,
|
3
|
+
:class => Brainzz::AnnotationsClickableCount do
|
4
|
+
annotations_clickable { rand(1_000_000) + 1 }
|
5
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
6
|
+
|
7
|
+
factory :brainzz_aggregate_annotations_clickable_count do
|
8
|
+
day nil
|
9
|
+
end
|
10
|
+
|
11
|
+
initialize_with do
|
12
|
+
Brainzz::AnnotationsClickableCount.new({})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_annotations_clicked_count,
|
3
|
+
:class => Brainzz::AnnotationsClickedCount do
|
4
|
+
annotations_clicked { rand(1_000_000) + 1 }
|
5
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
6
|
+
|
7
|
+
factory :brainzz_aggregate_annotations_clicked_count do
|
8
|
+
day nil
|
9
|
+
end
|
10
|
+
|
11
|
+
initialize_with do
|
12
|
+
Brainzz::AnnotationsClickedCount.new({})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_comment_count, :class => Brainzz::CommentCount do
|
3
|
+
comments { rand(1_000_000) + 1 }
|
4
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
5
|
+
|
6
|
+
factory :brainzz_aggregate_comment_count do
|
7
|
+
day nil
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with do
|
11
|
+
Brainzz::CommentCount.new({})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :brainzz_dislike_count, :class => Brainzz::DislikeCount do
|
3
|
-
dislikes
|
4
|
-
day
|
3
|
+
dislikes { rand(1_000_000) + 1 }
|
4
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
5
5
|
|
6
6
|
factory :brainzz_aggregate_dislike_count do
|
7
7
|
day nil
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :brainzz_like_count, :class => Brainzz::LikeCount do
|
3
|
-
likes
|
4
|
-
day
|
3
|
+
likes { rand(1_000_000) + 1 }
|
4
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
5
5
|
|
6
6
|
factory :brainzz_aggregate_like_count do
|
7
7
|
day nil
|
@@ -0,0 +1,15 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_subscribers_gained_count,
|
3
|
+
:class => Brainzz::SubscribersGainedCount do
|
4
|
+
subscribers_gained { rand(1_000_000) + 1 }
|
5
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
6
|
+
|
7
|
+
factory :brainzz_aggregate_subscribers_gained_count do
|
8
|
+
day nil
|
9
|
+
end
|
10
|
+
|
11
|
+
initialize_with do
|
12
|
+
Brainzz::SubscribersGainedCount.new({})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_subscribers_lost_count,
|
3
|
+
:class => Brainzz::SubscribersLostCount do
|
4
|
+
subscribers_lost { rand(1_000_000) + 1 }
|
5
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
6
|
+
|
7
|
+
factory :brainzz_aggregate_subscribers_lost_count do
|
8
|
+
day nil
|
9
|
+
end
|
10
|
+
|
11
|
+
initialize_with do
|
12
|
+
Brainzz::SubscribersLostCount.new({})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_view_duration, :class => Brainzz::ViewDuration do
|
3
|
+
duration { rand(1_000_000) + 1 }
|
4
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
5
|
+
|
6
|
+
factory :brainzz_aggregate_view_duration do
|
7
|
+
day nil
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with do
|
11
|
+
Brainzz::ViewDuration.new({})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :brainzz_view_percentage, :class => Brainzz::ViewPercentage do
|
3
|
+
percentage { rand(1_000_000) / 10000.0 }
|
4
|
+
day { Time.parse (DateTime.now - rand(100)).strftime('%F') }
|
5
|
+
|
6
|
+
factory :brainzz_aggregate_view_percentage do
|
7
|
+
day nil
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with do
|
11
|
+
Brainzz::ViewPercentage.new({})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class AnnotationsClickableCount < VideoStat
|
3
|
+
attr_accessor :annotations_clickable
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@annotations_clickable = normalize_stat(annotations_clickable_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def annotations_clickable_data
|
14
|
+
data && keys['annotationClickableImpressions'] &&
|
15
|
+
data[keys['annotationClickableImpressions']]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class AnnotationsClickedCount < VideoStat
|
3
|
+
attr_accessor :annotations_clicked
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@annotations_clicked = normalize_stat(annotations_clicked_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def annotations_clicked_data
|
14
|
+
data && keys['annotationClicks'] && data[keys['annotationClicks']]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class CommentCount < VideoStat
|
3
|
+
attr_accessor :comments
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@comments = normalize_stat(comment_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def comment_data
|
14
|
+
data && keys['comments'] && data[keys['comments']]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class SubscribersGainedCount < VideoStat
|
3
|
+
attr_accessor :subscribers_gained
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@subscribers_gained = normalize_stat(subscribers_gained_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def subscribers_gained_data
|
14
|
+
data && keys['subscribersGained'] && data[keys['subscribersGained']]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class SubscribersLostCount < VideoStat
|
3
|
+
attr_accessor :subscribers_lost
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@subscribers_lost = normalize_stat(subscribers_lost_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def subscribers_lost_data
|
14
|
+
data && keys['subscribersLost'] && data[keys['subscribersLost']]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class ViewDuration < VideoStat
|
3
|
+
attr_accessor :duration
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@duration = normalize_stat(duration_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def duration_data
|
14
|
+
data && keys['averageViewDuration'] &&
|
15
|
+
data[keys['averageViewDuration']]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Brainzz
|
2
|
+
class ViewPercentage < VideoStat
|
3
|
+
attr_accessor :percentage
|
4
|
+
|
5
|
+
def initialize(hash)
|
6
|
+
super
|
7
|
+
|
8
|
+
@percentage = normalize_stat(percentage_data)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def normalize_stat(stat)
|
14
|
+
stat.to_f if stat
|
15
|
+
end
|
16
|
+
|
17
|
+
def percentage_data
|
18
|
+
data && keys['averageViewPercentage'] &&
|
19
|
+
data[keys['averageViewPercentage']]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brainzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Herrick
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -179,7 +179,13 @@ files:
|
|
179
179
|
- README.md
|
180
180
|
- lib/brainzz.rb
|
181
181
|
- lib/brainzz/commands/analytics_command.rb
|
182
|
+
- lib/brainzz/commands/annotations_clickable_by_day_command.rb
|
183
|
+
- lib/brainzz/commands/annotations_clickable_totals_command.rb
|
184
|
+
- lib/brainzz/commands/annotations_clicked_by_day_command.rb
|
185
|
+
- lib/brainzz/commands/annotations_clicked_totals_command.rb
|
182
186
|
- lib/brainzz/commands/base_command.rb
|
187
|
+
- lib/brainzz/commands/comment_count_by_day_command.rb
|
188
|
+
- lib/brainzz/commands/comment_totals_command.rb
|
183
189
|
- lib/brainzz/commands/data_command.rb
|
184
190
|
- lib/brainzz/commands/dislike_count_by_day_command.rb
|
185
191
|
- lib/brainzz/commands/dislike_totals_command.rb
|
@@ -188,42 +194,72 @@ files:
|
|
188
194
|
- lib/brainzz/commands/playlist_items_command.rb
|
189
195
|
- lib/brainzz/commands/share_count_by_day_command.rb
|
190
196
|
- lib/brainzz/commands/share_totals_command.rb
|
197
|
+
- lib/brainzz/commands/subscribers_gained_by_day_command.rb
|
198
|
+
- lib/brainzz/commands/subscribers_gained_totals_command.rb
|
199
|
+
- lib/brainzz/commands/subscribers_lost_by_day_command.rb
|
200
|
+
- lib/brainzz/commands/subscribers_lost_totals_command.rb
|
191
201
|
- lib/brainzz/commands/video_details_command.rb
|
202
|
+
- lib/brainzz/commands/video_stats_by_day_command.rb
|
192
203
|
- lib/brainzz/commands/video_stats_command.rb
|
193
204
|
- lib/brainzz/commands/view_count_by_day_command.rb
|
205
|
+
- lib/brainzz/commands/view_duration_totals_command.rb
|
206
|
+
- lib/brainzz/commands/view_durations_by_day_command.rb
|
207
|
+
- lib/brainzz/commands/view_percentage_totals_command.rb
|
208
|
+
- lib/brainzz/commands/view_percentages_by_day_command.rb
|
194
209
|
- lib/brainzz/commands/view_totals_command.rb
|
195
210
|
- lib/brainzz/core.rb
|
196
211
|
- lib/brainzz/enums/view_source_enum.rb
|
197
212
|
- lib/brainzz/factories.rb
|
213
|
+
- lib/brainzz/factories/annotations_clickable_count.rb
|
214
|
+
- lib/brainzz/factories/annotations_clicked_count.rb
|
215
|
+
- lib/brainzz/factories/comment_count.rb
|
198
216
|
- lib/brainzz/factories/dislike_count.rb
|
199
217
|
- lib/brainzz/factories/like_count.rb
|
200
218
|
- lib/brainzz/factories/playlist_item.rb
|
201
219
|
- lib/brainzz/factories/playlist_items_wrapper.rb
|
202
220
|
- lib/brainzz/factories/sequences.rb
|
203
221
|
- lib/brainzz/factories/share_count.rb
|
222
|
+
- lib/brainzz/factories/subscribers_gained_count.rb
|
223
|
+
- lib/brainzz/factories/subscribers_lost_count.rb
|
204
224
|
- lib/brainzz/factories/video.rb
|
205
225
|
- lib/brainzz/factories/view_count.rb
|
226
|
+
- lib/brainzz/factories/view_duration.rb
|
227
|
+
- lib/brainzz/factories/view_percentage.rb
|
228
|
+
- lib/brainzz/models/annotations_clickable_count.rb
|
229
|
+
- lib/brainzz/models/annotations_clicked_count.rb
|
206
230
|
- lib/brainzz/models/base_model.rb
|
231
|
+
- lib/brainzz/models/comment_count.rb
|
207
232
|
- lib/brainzz/models/dislike_count.rb
|
208
233
|
- lib/brainzz/models/like_count.rb
|
209
234
|
- lib/brainzz/models/playlist_item.rb
|
210
235
|
- lib/brainzz/models/playlist_items_wrapper.rb
|
211
236
|
- lib/brainzz/models/share_count.rb
|
237
|
+
- lib/brainzz/models/subscribers_gained_count.rb
|
238
|
+
- lib/brainzz/models/subscribers_lost_count.rb
|
212
239
|
- lib/brainzz/models/video.rb
|
213
240
|
- lib/brainzz/models/video_stat.rb
|
214
241
|
- lib/brainzz/models/view_count.rb
|
242
|
+
- lib/brainzz/models/view_duration.rb
|
243
|
+
- lib/brainzz/models/view_percentage.rb
|
215
244
|
- lib/brainzz/params/analytics_params.rb
|
216
245
|
- lib/brainzz/params/base_params.rb
|
217
246
|
- lib/brainzz/params/playlist_items_params.rb
|
218
247
|
- lib/brainzz/params/video_details_params.rb
|
219
248
|
- lib/brainzz/params/video_stats_params.rb
|
249
|
+
- lib/brainzz/responses/annotations_clickable_response.rb
|
250
|
+
- lib/brainzz/responses/annotations_clicked_response.rb
|
251
|
+
- lib/brainzz/responses/comment_count_response.rb
|
220
252
|
- lib/brainzz/responses/dislike_count_response.rb
|
221
253
|
- lib/brainzz/responses/like_count_response.rb
|
222
254
|
- lib/brainzz/responses/playlist_items_response.rb
|
223
255
|
- lib/brainzz/responses/share_count_response.rb
|
256
|
+
- lib/brainzz/responses/subscribers_gained_response.rb
|
257
|
+
- lib/brainzz/responses/subscribers_lost_response.rb
|
224
258
|
- lib/brainzz/responses/video_details_response.rb
|
225
259
|
- lib/brainzz/responses/video_stats_response.rb
|
226
260
|
- lib/brainzz/responses/view_count_response.rb
|
261
|
+
- lib/brainzz/responses/view_duration_response.rb
|
262
|
+
- lib/brainzz/responses/view_percentage_response.rb
|
227
263
|
- lib/brainzz/services/access_token_service.rb
|
228
264
|
- license/gplv3.md
|
229
265
|
- license/lgplv3.md
|