yt 0.24.10 → 0.25.0
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/CHANGELOG.md +13 -1
- data/README.md +1 -1
- data/lib/yt/collections/reports.rb +8 -3
- data/lib/yt/models/channel.rb +3 -0
- data/lib/yt/models/video.rb +3 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_account/channel_spec.rb +1 -0
- data/spec/requests/as_account/video_spec.rb +1 -0
- data/spec/requests/as_content_owner/channel_spec.rb +58 -3
- data/spec/requests/as_content_owner/video_spec.rb +22 -1
- 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: c48d92d6630a165285e513cfac2088f1db048ecd
|
4
|
+
data.tar.gz: 06daf58ac858adcc4530aa48020d75f54fc2ece9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e884999cfe988df346878d3ddadd92192b13a05f83df035b452baf7ee7ee2f1bc3987ade999138a2a87af71a443beb9ea82ea038a948a95207054b2594d866ff
|
7
|
+
data.tar.gz: 80a2a1a53bd6faf28b3f629a4b7a051931e9be437428497237c2fdaa235c8bf3c1750094896aefd3c172277ab10e337b3317e19d243049608312eadf0a547ae8
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ 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.0 - 2015-06-29
|
10
|
+
|
11
|
+
**How to upgrade**
|
12
|
+
|
13
|
+
If your code expects 10 videos when calling a report `by: :video` or
|
14
|
+
`by: :related_video`, beware that those reports now return 25 videos.
|
15
|
+
If you only need the first 10, just add `.first(10)` to your result.
|
16
|
+
For instance: `channel.views(by: :video).first(10).to_h`.
|
17
|
+
|
18
|
+
* [ENHANCEMENT] Return 25 results on reports by video / related video.
|
19
|
+
* [FEATURE] New `playback_based_cpm` report for channels and videos.
|
20
|
+
|
9
21
|
## 0.24.10 - 2015-06-25
|
10
22
|
|
11
23
|
* [BUGFIX] Don't break reports `by: :playlist` when trying to fetch their part by limiting to result to 50 playlists.
|
@@ -111,7 +123,7 @@ If your code expects any of the following method to return Float values, then
|
|
111
123
|
be aware that they now return Integer. You can still call `to_f` if you do need
|
112
124
|
a Float: views, `comments`, `likes`, `dislikes`, `shares`, `subscribers_gained`,
|
113
125
|
`subscribers_lost`, `favorites_added`, `favorites_removed`, `annotations`,
|
114
|
-
`impressions`, `
|
126
|
+
`impressions`, `monetized_playbacks`, `playlist_starts`.
|
115
127
|
|
116
128
|
* [ENHANCEMENT] Return `Integer` values for reports that can never return decimal digits.
|
117
129
|
* [FEATURE] New `by: :range` option for reports, to return a metric without dimensions (that is, for the whole range)
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ To install on your system, run
|
|
41
41
|
|
42
42
|
To use inside a bundled Ruby project, add this line to the Gemfile:
|
43
43
|
|
44
|
-
gem 'yt', '~> 0.
|
44
|
+
gem 'yt', '~> 0.25.0'
|
45
45
|
|
46
46
|
Since the gem follows [Semantic Versioning](http://semver.org),
|
47
47
|
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
@@ -128,10 +128,15 @@ module Yt
|
|
128
128
|
params['end-date'] = @days_range.end
|
129
129
|
params['metrics'] = @metrics.keys.join(',').to_s.camelize(:lower)
|
130
130
|
params['dimensions'] = DIMENSIONS[@dimension][:name] unless @dimension == :range
|
131
|
-
params['max-results'] =
|
132
|
-
params['max-results'] = 50 if @dimension == :playlist
|
131
|
+
params['max-results'] = 50 if @dimension.in? [:playlist, :video]
|
133
132
|
params['max-results'] = 25 if @dimension.in? [:embedded_player_location, :related_video, :search_term, :referrer]
|
134
|
-
|
133
|
+
if @dimension.in? [:video, :playlist, :embedded_player_location, :related_video, :search_term, :referrer]
|
134
|
+
if @metrics.keys == [:earnings, :estimated_minutes_watched]
|
135
|
+
params['sort'] = '-earnings'
|
136
|
+
else
|
137
|
+
params['sort'] = "-#{@metrics.keys.join(',').to_s.camelize(:lower)}"
|
138
|
+
end
|
139
|
+
end
|
135
140
|
params[:filters] = "video==#{@videos.join ','}" if @videos
|
136
141
|
params[:filters] = ((params[:filters] || '').split(';') + ["country==US"]).compact.uniq.join(';') if @dimension == :state && !@state
|
137
142
|
params[:filters] = ((params[:filters] || '').split(';') + ["country==#{@country}"]).compact.uniq.join(';') if @country && !@state
|
data/lib/yt/models/channel.rb
CHANGED
data/lib/yt/models/video.rb
CHANGED
data/lib/yt/version.rb
CHANGED
@@ -196,6 +196,7 @@ describe Yt::Channel, :device_app do
|
|
196
196
|
expect{channel.earnings}.to raise_error Yt::Errors::Unauthorized
|
197
197
|
expect{channel.impressions}.to raise_error Yt::Errors::Unauthorized
|
198
198
|
expect{channel.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
|
199
|
+
expect{channel.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
|
199
200
|
|
200
201
|
expect{channel.views_on 3.days.ago}.not_to raise_error
|
201
202
|
expect{channel.comments_on 3.days.ago}.not_to raise_error
|
@@ -302,6 +302,7 @@ describe Yt::Video, :device_app do
|
|
302
302
|
expect{video.earnings}.to raise_error Yt::Errors::Unauthorized
|
303
303
|
expect{video.impressions}.to raise_error Yt::Errors::Unauthorized
|
304
304
|
expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
|
305
|
+
expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
|
305
306
|
expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
|
306
307
|
|
307
308
|
expect{video.views_on 3.days.ago}.not_to raise_error
|
@@ -19,7 +19,7 @@ describe Yt::Channel, :partner do
|
|
19
19
|
average_view_percentage: Float, annotation_clicks: Integer,
|
20
20
|
annotation_click_through_rate: Float,
|
21
21
|
annotation_close_rate: Float, earnings: Float, impressions: Integer,
|
22
|
-
monetized_playbacks: Integer}
|
22
|
+
monetized_playbacks: Integer, playback_based_cpm: Float}
|
23
23
|
|
24
24
|
specify 'by day, and are chronologically sorted' do
|
25
25
|
range = {since: 5.days.ago.to_date, until: 3.days.ago.to_date}
|
@@ -60,7 +60,7 @@ describe Yt::Channel, :partner do
|
|
60
60
|
:subscribers_gained, :subscribers_lost, :favorites_added,
|
61
61
|
:favorites_removed, :estimated_minutes_watched, :average_view_duration,
|
62
62
|
:average_view_percentage, :impressions, :monetized_playbacks,
|
63
|
-
:annotation_clicks, :annotation_click_through_rate,
|
63
|
+
:annotation_clicks, :annotation_click_through_rate, :playback_based_cpm,
|
64
64
|
:annotation_close_rate, :earnings].each do |metric|
|
65
65
|
describe "#{metric} can be retrieved for a range of days" do
|
66
66
|
let(:date_in) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
|
@@ -118,7 +118,7 @@ describe Yt::Channel, :partner do
|
|
118
118
|
annotation_clicks: Integer, annotation_click_through_rate: Float,
|
119
119
|
favorites_added: Integer, favorites_removed: Integer,
|
120
120
|
average_view_percentage: Float, impressions: Integer,
|
121
|
-
shares: Integer,
|
121
|
+
shares: Integer, playback_based_cpm: Float,
|
122
122
|
monetized_playbacks: Integer, annotation_close_rate: Float,
|
123
123
|
earnings: Float}.each do |metric, type|
|
124
124
|
describe "#{metric} can be retrieved for a specific day" do
|
@@ -1477,6 +1477,61 @@ describe Yt::Channel, :partner do
|
|
1477
1477
|
end
|
1478
1478
|
end
|
1479
1479
|
|
1480
|
+
describe 'playback-based CPM can be retrieved for a single country' do
|
1481
|
+
let(:country_code) { 'US' }
|
1482
|
+
let(:playback_based_cpm) { channel.playback_based_cpm since: date, by: by, in: location }
|
1483
|
+
let(:date) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
|
1484
|
+
|
1485
|
+
context 'and grouped by day' do
|
1486
|
+
let(:by) { :day }
|
1487
|
+
|
1488
|
+
context 'with the :in option set to the country code' do
|
1489
|
+
let(:location) { country_code }
|
1490
|
+
it { expect(playback_based_cpm.keys.min).to eq date.to_date }
|
1491
|
+
end
|
1492
|
+
|
1493
|
+
context 'with the :in option set to {country: country code}' do
|
1494
|
+
let(:location) { {country: country_code} }
|
1495
|
+
it { expect(playback_based_cpm.keys.min).to eq date.to_date }
|
1496
|
+
end
|
1497
|
+
end
|
1498
|
+
|
1499
|
+
context 'and grouped by country' do
|
1500
|
+
let(:by) { :country }
|
1501
|
+
|
1502
|
+
context 'with the :in option set to the country code' do
|
1503
|
+
let(:location) { country_code }
|
1504
|
+
it { expect(playback_based_cpm.keys).to eq [country_code] }
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
context 'with the :in option set to {country: country code}' do
|
1508
|
+
let(:location) { {country: country_code} }
|
1509
|
+
it { expect(playback_based_cpm.keys).to eq [country_code] }
|
1510
|
+
end
|
1511
|
+
end
|
1512
|
+
end
|
1513
|
+
|
1514
|
+
describe 'playback-based CPM can be grouped by day' do
|
1515
|
+
let(:range) { {since: 4.days.ago.to_date, until: 3.days.ago.to_date} }
|
1516
|
+
let(:keys) { range.values }
|
1517
|
+
|
1518
|
+
specify 'with the :by option set to :day' do
|
1519
|
+
playback_based_cpm = channel.playback_based_cpm range.merge by: :day
|
1520
|
+
expect(playback_based_cpm.keys).to eq range.values
|
1521
|
+
end
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
describe 'playback-based CPM can be grouped by country' do
|
1525
|
+
let(:range) { {since: ENV['YT_TEST_PARTNER_PLAYLIST_DATE']} }
|
1526
|
+
|
1527
|
+
specify 'with the :by option set to :country' do
|
1528
|
+
playbacks = channel.playback_based_cpm range.merge by: :country
|
1529
|
+
expect(playbacks.keys).to all(be_a String)
|
1530
|
+
expect(playbacks.keys.map(&:length).uniq).to eq [2]
|
1531
|
+
expect(playbacks.values).to all(be_a Float)
|
1532
|
+
end
|
1533
|
+
end
|
1534
|
+
|
1480
1535
|
describe 'annotation clicks can be retrieved for a single country' do
|
1481
1536
|
let(:country_code) { 'US' }
|
1482
1537
|
let(:annotation_clicks) { channel.annotation_clicks since: date, by: by, in: location }
|
@@ -17,7 +17,7 @@ describe Yt::Video, :partner do
|
|
17
17
|
:subscribers_gained, :subscribers_lost, :favorites_added,
|
18
18
|
:favorites_removed, :estimated_minutes_watched, :average_view_duration,
|
19
19
|
:average_view_percentage, :impressions, :monetized_playbacks,
|
20
|
-
:annotation_clicks, :annotation_click_through_rate,
|
20
|
+
:annotation_clicks, :annotation_click_through_rate, :playback_based_cpm,
|
21
21
|
:annotation_close_rate, :earnings].each do |metric|
|
22
22
|
describe "#{metric} can be retrieved for a range of days" do
|
23
23
|
let(:date_in) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
|
@@ -924,6 +924,27 @@ describe Yt::Video, :partner do
|
|
924
924
|
end
|
925
925
|
end
|
926
926
|
|
927
|
+
describe 'playback-based CPM can be grouped by day' do
|
928
|
+
let(:range) { {since: 4.days.ago.to_date, until: 3.days.ago.to_date} }
|
929
|
+
let(:keys) { range.values }
|
930
|
+
|
931
|
+
specify 'with the :by option set to :day' do
|
932
|
+
playback_based_cpm = video.playback_based_cpm range.merge by: :day
|
933
|
+
expect(playback_based_cpm.keys).to eq range.values
|
934
|
+
end
|
935
|
+
end
|
936
|
+
|
937
|
+
describe 'playback-based CPM can be grouped by country' do
|
938
|
+
let(:range) { {since: ENV['YT_TEST_PARTNER_VIDEO_DATE']} }
|
939
|
+
|
940
|
+
specify 'with the :by option set to :country' do
|
941
|
+
playbacks = video.playback_based_cpm range.merge by: :country
|
942
|
+
expect(playbacks.keys).to all(be_a String)
|
943
|
+
expect(playbacks.keys.map(&:length).uniq).to eq [2]
|
944
|
+
expect(playbacks.values).to all(be_a Float)
|
945
|
+
end
|
946
|
+
end
|
947
|
+
|
927
948
|
describe 'annotation clicks can be retrieved for a single US state' do
|
928
949
|
let(:state_code) { 'CA' }
|
929
950
|
let(:clicks) { video.annotation_clicks since: date, by: by, in: location }
|
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.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|