yt 0.25.38 → 0.25.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/yt/collections/reports.rb +38 -2
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/video_spec.rb +13 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b701173881774d821857b69ea48b6d4ac68e2ecc
|
4
|
+
data.tar.gz: be5e5d66828e51030cb4404a10c959a0273cda54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa7e8bef3a6345f5f6797c751bdedfa6b130b27ca1d93b3f5b73ed6cec9cb9252e07b4c96608a3ea0227d42e87a7b507593621594de2a8c7864a0ecbfc45c73d
|
7
|
+
data.tar.gz: b9e45f9d86ccec67cce14894b3f2c22587241951048d2710f75dbeb9115cf64040ee25d77ef2b30952cbbe21a15bc449355b2245d24899300a14779e54a20b76
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.25.39 - 2016-06-15
|
10
|
+
|
11
|
+
* [FEATURE] Add `by: :operating_system` option for reports, to return views (from a `content_owner.video`) by operating system.
|
12
|
+
* [FEATURE] Add `Yt::Collections::Reports::DEVICE_TYPES` to list all device types supported by YouTube Analytics API.
|
13
|
+
* [FEATURE] Add `Yt::Collections::Reports::OPERATING_SYSTEMS` to list all operating systems supported by YouTube Analytics API.
|
14
|
+
|
9
15
|
## 0.25.38 - 2016-06-13
|
10
16
|
|
11
17
|
* [IMPROVEMENT] Don’t combine forContentOwner and publishedBefore parameters in Search#list since YouTube does not support this anymore.
|
@@ -16,7 +16,8 @@ module Yt
|
|
16
16
|
hash[:referrer] = {name: 'insightTrafficSourceDetail', parse: ->(url, *values) {@metrics.keys.zip(values.map{|v| {url => v}}).to_h} }
|
17
17
|
hash[:video] = {name: 'video', parse: ->(video_id, *values) { @metrics.keys.zip(values.map{|v| {video_id => v}}).to_h} }
|
18
18
|
hash[:playlist] = {name: 'playlist', parse: ->(playlist_id, *values) { @metrics.keys.zip(values.map{|v| {playlist_id => v}}).to_h} }
|
19
|
-
hash[:device_type] = {name: 'deviceType', parse: ->(type, *values) {@metrics.keys.zip(values.map{|v| {type
|
19
|
+
hash[:device_type] = {name: 'deviceType', parse: ->(type, *values) {@metrics.keys.zip(values.map{|v| {DEVICE_TYPES.key(type) => v}}).to_h} }
|
20
|
+
hash[:operating_system] = {name: 'operatingSystem', parse: ->(os, *values) {@metrics.keys.zip(values.map{|v| {OPERATING_SYSTEMS.key(os) => v}}).to_h} }
|
20
21
|
hash[:country] = {name: 'country', parse: ->(country_code, *values) { @metrics.keys.zip(values.map{|v| {country_code => v}}).to_h} }
|
21
22
|
hash[:state] = {name: 'province', parse: ->(country_and_state_code, *values) { @metrics.keys.zip(values.map{|v| {country_and_state_code[3..-1] => v}}).to_h} }
|
22
23
|
hash[:gender_age_group] = {name: 'gender,ageGroup', parse: ->(gender, *values) { [gender.downcase.to_sym, *values] }}
|
@@ -58,6 +59,41 @@ module Yt
|
|
58
59
|
mobile: 'MOBILE' # only present for data < September 10, 2013
|
59
60
|
}
|
60
61
|
|
62
|
+
# @see https://developers.google.com/youtube/analytics/v1/dimsmets/dims#Device_Dimensions
|
63
|
+
DEVICE_TYPES = {
|
64
|
+
desktop: 'DESKTOP',
|
65
|
+
game_console: 'GAME_CONSOLE',
|
66
|
+
mobile: 'MOBILE',
|
67
|
+
tablet: 'TABLET',
|
68
|
+
tv: 'TV',
|
69
|
+
unknown_platform: 'UNKNOWN_PLATFORM'
|
70
|
+
}
|
71
|
+
|
72
|
+
# @see https://developers.google.com/youtube/analytics/v1/dimsmets/dims#Device_Dimensions
|
73
|
+
OPERATING_SYSTEMS = {
|
74
|
+
android: 'ANDROID',
|
75
|
+
bada: 'BADA',
|
76
|
+
blackberry: 'BLACKBERRY',
|
77
|
+
chromecast: 'CHROMECAST',
|
78
|
+
docomo: 'DOCOMO',
|
79
|
+
hiptop: 'HIPTOP',
|
80
|
+
ios: 'IOS',
|
81
|
+
linux: 'LINUX',
|
82
|
+
macintosh: 'MACINTOSH',
|
83
|
+
meego: 'MEEGO',
|
84
|
+
nintendo_3ds: 'NINTENDO_3DS',
|
85
|
+
other: 'OTHER',
|
86
|
+
playstation: 'PLAYSTATION',
|
87
|
+
playstation_vita: 'PLAYSTATION_VITA',
|
88
|
+
smart_tv: 'SMART_TV',
|
89
|
+
symbian: 'SYMBIAN',
|
90
|
+
webos: 'WEBOS',
|
91
|
+
wii: 'WII',
|
92
|
+
windows: 'WINDOWS',
|
93
|
+
windows_mobile: 'WINDOWS_MOBILE',
|
94
|
+
xbox: 'XBOX'
|
95
|
+
}
|
96
|
+
|
61
97
|
attr_writer :metrics
|
62
98
|
|
63
99
|
def within(days_range, country, state, dimension, videos, try_again = true)
|
@@ -88,7 +124,7 @@ module Yt
|
|
88
124
|
end
|
89
125
|
elsif dimension == :day
|
90
126
|
hash = hash.transform_values{|h| h.sort_by{|day, v| day}.to_h}
|
91
|
-
elsif dimension.in? [:traffic_source, :country, :state, :playback_location, :device_type]
|
127
|
+
elsif dimension.in? [:traffic_source, :country, :state, :playback_location, :device_type, :operating_system]
|
92
128
|
hash = hash.transform_values{|h| h.sort_by{|range, v| -v}.to_h}
|
93
129
|
end
|
94
130
|
(@metrics.one? || @metrics.keys == [:earnings, :estimated_minutes_watched]) ? hash[@metrics.keys.first] : hash
|
data/lib/yt/version.rb
CHANGED
@@ -383,10 +383,21 @@ describe Yt::Video, :partner do
|
|
383
383
|
|
384
384
|
describe 'views can be grouped by device type' do
|
385
385
|
let(:range) { {since: ENV['YT_TEST_PARTNER_VIDEO_DATE']} }
|
386
|
+
let(:keys) { Yt::Collections::Reports::DEVICE_TYPES.keys }
|
386
387
|
|
387
388
|
specify 'with the :by option set to :device_type' do
|
388
389
|
views = video.views range.merge by: :device_type
|
389
|
-
expect(views.keys).to
|
390
|
+
expect(views.keys - keys).to be_empty
|
391
|
+
expect(views.values).to all(be_an Integer)
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
describe 'views can be grouped by operating system' do
|
396
|
+
let(:keys) { Yt::Collections::Reports::OPERATING_SYSTEMS.keys }
|
397
|
+
|
398
|
+
specify 'with the :by option set to :operating_system' do
|
399
|
+
views = video.views by: :operating_system
|
400
|
+
expect(views.keys - keys).to be_empty
|
390
401
|
expect(views.values).to all(be_an Integer)
|
391
402
|
end
|
392
403
|
end
|
@@ -1282,4 +1293,4 @@ describe Yt::Video, :partner do
|
|
1282
1293
|
end
|
1283
1294
|
end
|
1284
1295
|
end
|
1285
|
-
end
|
1296
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.25.
|
4
|
+
version: 0.25.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|