yt 0.26.3 → 0.27.0

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: 9c8bd5aecd37bbb0c4209b5fa1b0c7b425610629
4
- data.tar.gz: 008187e83de0b7e3da55e65b12ff42ccb3f1dd40
3
+ metadata.gz: 9ae245f2241c225b65e4d6d45e98f9124afcca9a
4
+ data.tar.gz: 5712381f9ea126fe61729b21ed517a1bc9429b55
5
5
  SHA512:
6
- metadata.gz: 558f54d0e5e96a1d8bdec7bd737c7fbd5b3706a675c04baf36176b100735f95633e6412a3fa1f445b2f0c7c713832dfc309a07a2cf112fccd0b0d94c84a9dc42
7
- data.tar.gz: 45cd8bb547e80018da19faabfd2a89adfbcce1035382c1192d1cead129ab583f778e8e82a7c028b261db0c25d8091a270d4a4863e225719a5242c3717ccde812
6
+ metadata.gz: 69b149b667c9f0684320faa6a45bd62e153cedd1b5d515c2e98f8dfe15b4286a7cda911cb2bc1eee8b5df2ed15ca7b8fad86b525b6f82d1e6a5a13c3a6df9bb4
7
+ data.tar.gz: a0701e11530ae0e98a02ef07de7b40be1f1647e557de920de265e21718a886541693f6e14b150d33754495743b2afcbd04fc6796ea960469f5ad4f2eac3e35c0
@@ -6,6 +6,43 @@ 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.27.0 - 2016-10-07
10
+
11
+ **How to upgrade**
12
+
13
+ If your code calls any of the following `..._on` method to fetch metrics on
14
+ a specific day, you need to replace it with the equivalent method that does
15
+ not end with `_on`. For instance replace `views_on(3.days.ago)` with the
16
+ equivalent `views(since: 3.days.ago, until: 3.days.ago)`.
17
+
18
+ * [REMOVAL] Remove `#views_on` method for channels, playlists, videos and video groups
19
+ * [REMOVAL] Remove `#uniques_on` method for channels, playlists, videos and video groups
20
+ * [REMOVAL] Remove `#estimated_minutes_watched_on` method for channels, playlists, videos and video groups
21
+ * [REMOVAL] Remove `#viewer_percentage_on` method for channels, playlists, videos and video groups
22
+ * [REMOVAL] Remove `#comments_on` method for channels, playlists, videos and video groups
23
+ * [REMOVAL] Remove `#likes_on` method for channels, playlists, videos and video groups
24
+ * [REMOVAL] Remove `#dislikes_on` method for channels, playlists, videos and video groups
25
+ * [REMOVAL] Remove `#shares_on` method for channels, playlists, videos and video groups
26
+ * [REMOVAL] Remove `#subscribers_gained_on` method for channels, playlists, videos and video groups
27
+ * [REMOVAL] Remove `#subscribers_lost_on` method for channels, playlists, videos and video groups
28
+ * [REMOVAL] Remove `#videos_added_to_playlists_on` method for channels, playlists, videos and video groups
29
+ * [REMOVAL] Remove `#videos_removed_from_playlists_on` method for channels, playlists, videos and video groups
30
+ * [REMOVAL] Remove `#average_view_duration_on` method for channels, playlists, videos and video groups
31
+ * [REMOVAL] Remove `#average_view_percentage_on` method for channels, playlists, videos and video groups
32
+ * [REMOVAL] Remove `#annotation_clicks_on` method for channels, playlists, videos and video groups
33
+ * [REMOVAL] Remove `#annotation_click_through_rate_on` method for channels, playlists, videos and video groups
34
+ * [REMOVAL] Remove `#annotation_close_rate_on` method for channels, playlists, videos and video groups
35
+ * [REMOVAL] Remove `#card_impressions_on` method for channels, playlists, videos and video groups
36
+ * [REMOVAL] Remove `#card_clicks_on` method for channels, playlists, videos and video groups
37
+ * [REMOVAL] Remove `#card_click_rate_on` method for channels, playlists, videos and video groups
38
+ * [REMOVAL] Remove `#card_teaser_impressions_on` method for channels, playlists, videos and video groups
39
+ * [REMOVAL] Remove `#card_teaser_clicks_on` method for channels, playlists, videos and video groups
40
+ * [REMOVAL] Remove `#card_teaser_click_rate_on` method for channels, playlists, videos and video groups
41
+ * [REMOVAL] Remove `#earnings_on` method for channels, playlists, videos and video groups
42
+ * [REMOVAL] Remove `#impressions_on` method for channels, playlists, videos and video groups
43
+ * [REMOVAL] Remove `#monetized_playbacks_on` method for channels, playlists, videos and video groups
44
+ * [REMOVAL] Remove `#playback_based_cpm_on` method for channels, playlists, videos and video groups
45
+
9
46
  ## 0.26.3 - 2016-10-07
10
47
 
11
48
  * [FEATURE] Add `by: :subscribed_status` option for reports, to return views (from a `content_owner.video`) by subscribed status.
@@ -607,7 +644,7 @@ error by using the `unsubscribe` method:
607
644
 
608
645
  ## 0.11.5 - 2014-08-27
609
646
 
610
- * [BUGFIX] Make videos.where(id: 'MESycYJytkU').first.id return 'MESycYJytkU'
647
+ * [BUGFIX] Make videos.where(id: 'jNQXAC9IVRw').first.id return 'jNQXAC9IVRw'
611
648
 
612
649
  ## 0.11.4 - 2014-08-27
613
650
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ channel.videos.count #=> 12
23
23
  ```
24
24
 
25
25
  ```ruby
26
- video = Yt::Video.new id: 'MESycYJytkU'
26
+ video = Yt::Video.new id: 'jNQXAC9IVRw'
27
27
  video.title #=> "Fullscreen Creator Platform"
28
28
  video.comment_count #=> 308
29
29
  video.hd? #=> true
@@ -83,7 +83,7 @@ content_owner.partnered_channels.where(part: 'statistics').map &:subscriber_coun
83
83
 
84
84
  content_owner.claims.where(q: 'Fullscreen').count #=> 24
85
85
  content_owner.claims.first #=> #<Yt::Models::Claim @id=...>
86
- content_owner.claims.first.video_id #=> 'MESycYJytkU'
86
+ content_owner.claims.first.video_id #=> 'jNQXAC9IVRw'
87
87
  content_owner.claims.first.status #=> "active"
88
88
 
89
89
  reference = content_owner.references.where(asset_id: "ABCDEFG").first #=> #<Yt::Models::Reference @id=...>
@@ -178,7 +178,7 @@ videos = Yt::Collections::Videos.new
178
178
  videos.where(order: 'viewCount').first.title #=> "PSY - GANGNAM STYLE"
179
179
  videos.where(q: 'Fullscreen CreatorPlatform', safe_search: 'none').size #=> 324
180
180
  videos.where(chart: 'mostPopular', video_category_id: 44).first.title #=> "SINISTER - Trailer"
181
- videos.where(id: 'MESycYJytkU,invalid').map(&:title) #=> ["Fullscreen Creator Platform"]
181
+ videos.where(id: 'jNQXAC9IVRw,invalid').map(&:title) #=> ["Fullscreen Creator Platform"]
182
182
  ```
183
183
 
184
184
  *The methods above do not require authentication.*
@@ -293,7 +293,7 @@ Use [Yt::AdvertisingOptionsSet](http://www.rubydoc.info/gems/yt/Yt/Models/Advert
293
293
 
294
294
  ```ruby
295
295
  content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
296
- ad_options = Yt::AdvertisingOptionsSet.new video_id: 'MESycYJytkU', auth: $content_owner
296
+ ad_options = Yt::AdvertisingOptionsSet.new video_id: 'jNQXAC9IVRw', auth: $content_owner
297
297
  ad_options.update ad_formats: %w(standard_instream long) #=> true
298
298
  ```
299
299
 
@@ -206,18 +206,17 @@ module Yt
206
206
  # @macro report
207
207
  # @macro report_with_country_and_state
208
208
 
209
- # Defines two public instance methods to access the reports of a
209
+ # Defines a public instance methods to access the reports of a
210
210
  # resource for a specific metric.
211
211
  # @param [Symbol] metric the metric to access the reports of.
212
212
  # @param [Class] type The class to cast the returned values to.
213
- # @example Adds +comments+ and +comments_on+ on a Channel resource.
213
+ # @example Adds +comments+ on a Channel resource.
214
214
  # class Channel < Resource
215
215
  # has_report :comments, Integer
216
216
  # end
217
217
  def has_report(metric, type)
218
218
  require 'yt/collections/reports'
219
219
 
220
- define_metric_on_method metric
221
220
  define_metric_method metric
222
221
  define_reports_method metric, type
223
222
  define_range_metric_method metric
@@ -226,12 +225,6 @@ module Yt
226
225
 
227
226
  private
228
227
 
229
- def define_metric_on_method(metric)
230
- define_method "#{metric}_on" do |date|
231
- send(metric, from: date, to: date, by: :day).values.first
232
- end
233
- end
234
-
235
228
  def define_reports_method(metric, type)
236
229
  (@metrics ||= {})[metric] = type
237
230
  define_method :reports do |options = {}|
@@ -10,7 +10,7 @@ module Yt
10
10
  class Description < String
11
11
  # @return [Boolean] whether the description includes a link to a video
12
12
  # @example
13
- # description = Yt::Models::Description.new 'Link to video: youtube.com/watch?v=MESycYJytkU'
13
+ # description = Yt::Models::Description.new 'Link to video: youtube.com/watch?v=9bZkp7q19f0'
14
14
  # description.has_link_to_video? #=> true
15
15
  #
16
16
  # @todo add an option to match the link to a specific video
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.26.3'
2
+ VERSION = '0.27.0'
3
3
  end
@@ -6,7 +6,7 @@ require 'yt/collections/playlist_items'
6
6
  describe Yt::Collections::PlaylistItems do
7
7
  subject(:collection) { Yt::Collections::PlaylistItems.new parent: playlist }
8
8
  let(:playlist) { Yt::Playlist.new id: 'LLxO1tY8h1AhOz0T4ENwmpow' }
9
- let(:attrs) { {id: 'MESycYJytkU', kind: :video} }
9
+ let(:attrs) { {id: '9bZkp7q19f0', kind: :video} }
10
10
  let(:msg) { {response_body: {error: {errors: [{reason: reason}]}}}.to_json }
11
11
  before { expect(collection).to behave }
12
12
 
@@ -86,7 +86,7 @@ describe Yt::Annotation do
86
86
  end
87
87
 
88
88
  context 'given an annotation with an embedded playlist link' do
89
- let(:xml) { '<TEXT>https://www.youtube.com/watch?v=MESycYJytkU&amp;list=LLxO1tY8h1AhOz0T4ENwmpow"</TEXT>' }
89
+ let(:xml) { '<TEXT>https://www.youtube.com/watch?v=9bZkp7q19f0&amp;list=LLxO1tY8h1AhOz0T4ENwmpow"</TEXT>' }
90
90
  it { expect(annotation).to have_link_to_playlist }
91
91
  end
92
92
 
@@ -20,8 +20,8 @@ describe Yt::Claim do
20
20
 
21
21
  describe '#video_id' do
22
22
  context 'given fetching a claim returns an videoId' do
23
- let(:data) { {"videoId"=>"MESycYJytkU"} }
24
- it { expect(claim.video_id).to eq 'MESycYJytkU' }
23
+ let(:data) { {"videoId"=>"9bZkp7q19f0"} }
24
+ it { expect(claim.video_id).to eq '9bZkp7q19f0' }
25
25
  end
26
26
  end
27
27
 
@@ -21,24 +21,24 @@ describe Yt::Description do
21
21
  end
22
22
 
23
23
  context 'with a video long URL' do
24
- let(:text) { 'example.com and Link to video: youtube.com/watch?v=MESycYJytkU' }
24
+ let(:text) { 'example.com and Link to video: youtube.com/watch?v=9bZkp7q19f0' }
25
25
  it { expect(description).to have_link_to_video }
26
26
  end
27
27
 
28
28
  context 'with a video short URL' do
29
- let(:text) { 'Link to video: youtu.be/MESycYJytkU' }
29
+ let(:text) { 'Link to video: youtu.be/9bZkp7q19f0' }
30
30
  it { expect(description).to have_link_to_video }
31
31
  end
32
32
 
33
33
  context 'with a playlist-embedded video URL' do
34
- let(:text) { 'Link to video in playlist: youtube.com/watch?v=MESycYJytkU&index=619&list=LLxO1tY8h1AhOz0T4ENwmpow' }
34
+ let(:text) { 'Link to video in playlist: youtube.com/watch?v=9bZkp7q19f0&index=619&list=LLxO1tY8h1AhOz0T4ENwmpow' }
35
35
  it { expect(description).to have_link_to_video }
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#has_link_to_channel?' do
40
40
  context 'without a channel URL' do
41
- let(:text) { 'youtu.be/MESycYJytkU is a video link' }
41
+ let(:text) { 'youtu.be/9bZkp7q19f0 is a video link' }
42
42
  it { expect(description).not_to have_link_to_channel }
43
43
  end
44
44
 
@@ -60,7 +60,7 @@ describe Yt::Description do
60
60
 
61
61
  describe '#has_link_to_subscribe?' do
62
62
  context 'without a subscribe URL' do
63
- let(:text) { 'Link to video: youtu.be/MESycYJytkU' }
63
+ let(:text) { 'Link to video: youtu.be/9bZkp7q19f0' }
64
64
  it { expect(description).not_to have_link_to_subscribe }
65
65
  end
66
66
 
@@ -82,7 +82,7 @@ describe Yt::Description do
82
82
 
83
83
  describe '#has_link_to_playlist?' do
84
84
  context 'without a playlist URL' do
85
- let(:text) { 'Link to video: youtu.be/MESycYJytkU' }
85
+ let(:text) { 'Link to video: youtu.be/9bZkp7q19f0' }
86
86
  it { expect(description).not_to have_link_to_playlist }
87
87
  end
88
88
 
@@ -156,8 +156,8 @@ describe Yt::Reference do
156
156
 
157
157
  describe '#video_id' do
158
158
  context 'given fetching a reference returns an videoId' do
159
- let(:data) { {"videoId"=>"MESycYJytkU"} }
160
- it { expect(reference.video_id).to eq 'MESycYJytkU' }
159
+ let(:data) { {"videoId"=>"9bZkp7q19f0"} }
160
+ it { expect(reference.video_id).to eq '9bZkp7q19f0' }
161
161
  end
162
162
  end
163
163
 
@@ -5,9 +5,9 @@ describe Yt::Resource do
5
5
  subject(:resource) { Yt::Resource.new attrs }
6
6
 
7
7
  context 'given a resource initialized with a URL (containing an ID)' do
8
- let(:attrs) { {url: 'youtu.be/MESycYJytkU'} }
8
+ let(:attrs) { {url: 'youtu.be/9bZkp7q19f0'} }
9
9
 
10
- it { expect(resource.id).to eq 'MESycYJytkU' }
10
+ it { expect(resource.id).to eq '9bZkp7q19f0' }
11
11
  it { expect(resource.kind).to eq 'video' }
12
12
  it { expect(resource.username).to be_nil }
13
13
  end
@@ -7,34 +7,34 @@ describe Yt::URL do
7
7
  subject(:url) { Yt::URL.new text }
8
8
 
9
9
  context 'given a long video URL' do
10
- let(:text) { 'youtube.com/watch?v=MESycYJytkU' }
10
+ let(:text) { 'youtube.com/watch?v=9bZkp7q19f0' }
11
11
  it {expect(url.kind).to eq :video }
12
- it {expect(url.id).to eq 'MESycYJytkU' }
12
+ it {expect(url.id).to eq '9bZkp7q19f0' }
13
13
  it {expect(url.username).to be_nil }
14
14
  end
15
15
 
16
16
  context 'given a short video URL' do
17
- let(:text) { 'https://youtu.be/MESycYJytkU' }
17
+ let(:text) { 'https://youtu.be/9bZkp7q19f0' }
18
18
  it {expect(url.kind).to eq :video }
19
- it {expect(url.id).to eq 'MESycYJytkU' }
19
+ it {expect(url.id).to eq '9bZkp7q19f0' }
20
20
  end
21
21
 
22
22
  context 'given an embed video URL' do
23
- let(:text) { 'https://www.youtube.com/embed/MESycYJytkU' }
23
+ let(:text) { 'https://www.youtube.com/embed/9bZkp7q19f0' }
24
24
  it {expect(url.kind).to eq :video }
25
- it {expect(url.id).to eq 'MESycYJytkU' }
25
+ it {expect(url.id).to eq '9bZkp7q19f0' }
26
26
  end
27
27
 
28
28
  context 'given a v video URL' do
29
- let(:text) { 'https://www.youtube.com/v/MESycYJytkU' }
29
+ let(:text) { 'https://www.youtube.com/v/9bZkp7q19f0' }
30
30
  it {expect(url.kind).to eq :video }
31
- it {expect(url.id).to eq 'MESycYJytkU' }
31
+ it {expect(url.id).to eq '9bZkp7q19f0' }
32
32
  end
33
33
 
34
34
  context 'given a playlist-embedded video URL' do
35
- let(:text) { 'youtube.com/watch?v=MESycYJytkU&list=LLxO1tY8h1AhOz0T4ENwmpow' }
35
+ let(:text) { 'youtube.com/watch?v=9bZkp7q19f0&list=LLxO1tY8h1AhOz0T4ENwmpow' }
36
36
  it {expect(url.kind).to eq :video }
37
- it {expect(url.id).to eq 'MESycYJytkU' }
37
+ it {expect(url.id).to eq '9bZkp7q19f0' }
38
38
  end
39
39
 
40
40
  context 'given a long channel URL' do
@@ -649,7 +649,7 @@ describe Yt::Video do
649
649
  end
650
650
 
651
651
  describe '#update' do
652
- let(:attrs) { {id: 'MESycYJytkU', snippet: {'title'=>'old'}} }
652
+ let(:attrs) { {id: '9bZkp7q19f0', snippet: {'title'=>'old'}} }
653
653
  before { expect(video).to receive(:do_update).and_yield 'snippet'=>{'title'=>'new'} }
654
654
 
655
655
  it { expect(video.update title: 'new').to be true }
@@ -27,10 +27,7 @@ describe Yt::Account, :device_app do
27
27
  expect(uploads).not_to be_empty
28
28
  end
29
29
 
30
- specify 'includes private playlists (such as Watch Later or History)' do
31
- watch_later = related_playlists.select{|p| p.title == 'Watch Later'}
32
- expect(watch_later).not_to be_empty
33
-
30
+ specify 'includes private playlists (such as History)' do
34
31
  history = related_playlists.select{|p| p.title == 'History'}
35
32
  expect(history).not_to be_empty
36
33
  end
@@ -41,7 +41,7 @@ describe Yt::Account, :device_app do
41
41
  end
42
42
 
43
43
  context 'that is invalid' do
44
- let(:authorization_code) { '--not-a-valid-authorization-code--' }
44
+ let(:authorization_code) { rand(36**20).to_s(36) }
45
45
  it { expect{account.authentication}.to raise_error Yt::Errors::Unauthorized }
46
46
  end
47
47
  end
@@ -104,18 +104,6 @@ describe Yt::Account, :device_app do
104
104
 
105
105
  it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
106
106
  end
107
-
108
- context 'and no device token' do
109
- it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
110
- end
111
-
112
- # NOTE: This test is commented out because of YouTube irrational behavior
113
- # of using to return "MissingAuth" when passing a wrong device code, and
114
- # now randomly returning `{"error"=>"internal_failure"}` instead.
115
- # context 'and an invalid device code' do
116
- # before { attrs[:device_code] = '--not-a-valid-device-code--' }
117
- # it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
118
- # end
119
107
  end
120
108
 
121
109
  context 'given no token or code' do
@@ -80,23 +80,6 @@ describe Yt::Channel, :device_app do
80
80
  expect(channel.video_count).to be > 500
81
81
  expect(channel.videos.size).to be > 500
82
82
  end
83
-
84
- specify 'over 500 videos can only be retrieved when sorting by date' do
85
- # @note: these tests are slow because they go through multiple pages
86
- # of results to test that we can overcome YouTube’s limitation of only
87
- # returning the first 500 results when ordered by date.
88
- expect(channel.videos.count).to be > 500
89
- expect(channel.videos.count).to eq channel.videos.map(&:id).uniq.count
90
- expect(channel.videos.where(order: 'viewCount').count).to be 500
91
- end
92
-
93
- specify 'over 500 videos can be retrieved even with a publishedBefore condition' do
94
- # @note: these tests are slow because they go through multiple pages
95
- # of results to test that we can overcome YouTube’s limitation of only
96
- # returning the first 500 results when ordered by date.
97
- today = Date.today.beginning_of_day.iso8601(0)
98
- expect(channel.videos.where(published_before: today).count).to be > 500
99
- end
100
83
  end
101
84
  end
102
85
 
@@ -165,8 +148,12 @@ describe Yt::Channel, :device_app do
165
148
  before { channel.throttle_subscriptions }
166
149
 
167
150
  it { expect(channel.subscribed?).to be true }
168
- it { expect(channel.subscribe).to be_falsey }
169
- it { expect{channel.subscribe!}.to raise_error Yt::Errors::RequestError }
151
+ # NOTE: These tests are commented out because YouTube randomly changed the
152
+ # behavior of the API without changing the documentation, so subscribing
153
+ # to a channel you are already subscribed to does not raise an error
154
+ # anymore.
155
+ # it { expect(channel.subscribe).to be_falsey }
156
+ # it { expect{channel.subscribe!}.to raise_error Yt::Errors::RequestError }
170
157
 
171
158
  context 'when I unsubscribe' do
172
159
  before { channel.unsubscribe }
@@ -196,7 +183,7 @@ describe Yt::Channel, :device_app do
196
183
 
197
184
  it { expect(channel.delete_playlists title: %r{#{params[:title]}}).to eq [true] }
198
185
  it { expect(channel.delete_playlists params).to eq [true] }
199
- it { expect{channel.delete_playlists params}.to change{channel.playlists.count}.by(-1) }
186
+ it { expect{channel.delete_playlists params}.to change{sleep 1; channel.playlists.count}.by(-1) }
200
187
  end
201
188
 
202
189
  # Can't subscribe to your own channel.
@@ -232,26 +219,6 @@ describe Yt::Channel, :device_app do
232
219
  expect{channel.impressions}.to raise_error Yt::Errors::Unauthorized
233
220
  expect{channel.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
234
221
  expect{channel.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
235
-
236
- expect{channel.views_on 3.days.ago}.not_to raise_error
237
- expect{channel.comments_on 3.days.ago}.not_to raise_error
238
- expect{channel.likes_on 3.days.ago}.not_to raise_error
239
- expect{channel.dislikes_on 3.days.ago}.not_to raise_error
240
- expect{channel.shares_on 3.days.ago}.not_to raise_error
241
- expect{channel.subscribers_gained_on 3.days.ago}.not_to raise_error
242
- expect{channel.subscribers_lost_on 3.days.ago}.not_to raise_error
243
- expect{channel.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
244
- expect{channel.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
245
- expect{channel.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
246
- expect{channel.average_view_duration_on 3.days.ago}.not_to raise_error
247
- expect{channel.average_view_percentage_on 3.days.ago}.not_to raise_error
248
- expect{channel.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
249
- expect{channel.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
250
- end
251
-
252
- it 'cannot give information about its content owner' do
253
- expect{channel.content_owner}.to raise_error Yt::Errors::Forbidden
254
- expect{channel.linked_at}.to raise_error Yt::Errors::Forbidden
255
222
  end
256
223
  end
257
224
 
@@ -5,7 +5,7 @@ describe Yt::PlaylistItem, :device_app do
5
5
  subject(:item) { Yt::PlaylistItem.new id: id, auth: $account }
6
6
 
7
7
  context 'given an existing playlist item' do
8
- let(:id) { 'PLjW_GNR5Ir0GMlbJzA-aW0UV8TchJFb8p3uzrLNcZKPY' }
8
+ let(:id) { 'UExTV1lrWXpPclBNVDlwSkc1U3Q1RzBXRGFsaFJ6R2tVNC4yQUE2Q0JEMTk4NTM3RTZC' }
9
9
 
10
10
  it 'returns valid metadata' do
11
11
  expect(item.title).to be_a String
@@ -32,8 +32,8 @@ describe Yt::PlaylistItem, :device_app do
32
32
  context 'given one of my own playlist items that I want to update' do
33
33
  before(:all) do
34
34
  @my_playlist = $account.create_playlist title: "Yt Test Update Playlist Item #{rand}"
35
- @my_playlist.add_video 'MESycYJytkU'
36
- @my_playlist_item = @my_playlist.add_video 'MESycYJytkU'
35
+ @my_playlist.add_video '9bZkp7q19f0'
36
+ @my_playlist_item = @my_playlist.add_video '9bZkp7q19f0'
37
37
  end
38
38
  after(:all) { @my_playlist.delete }
39
39
 
@@ -48,18 +48,6 @@ describe Yt::Playlist, :device_app do
48
48
  end
49
49
  end
50
50
 
51
- context 'given a playlist that only includes other people’s private or deleted videos' do
52
- let(:id) { 'PLsnYEvcCzABOsJdehqkIDhwz8CPGWzX59' }
53
-
54
- describe '.playlist_items.includes(:video)' do
55
- let(:items) { playlist.playlist_items.includes(:video).map{|i| i} }
56
-
57
- specify 'returns nil (without running an infinite loop)' do
58
- expect(items.size).to be 2
59
- end
60
- end
61
- end
62
-
63
51
  context 'given an unknown playlist' do
64
52
  let(:id) { 'not-a-playlist-id' }
65
53
 
@@ -69,10 +57,10 @@ describe Yt::Playlist, :device_app do
69
57
 
70
58
  context 'given someone else’s playlist' do
71
59
  let(:id) { 'PLSWYkYzOrPMT9pJG5St5G0WDalhRzGkU4' }
72
- let(:video_id) { 'MESycYJytkU' }
60
+ let(:video_id) { '9bZkp7q19f0' }
73
61
 
74
- it { expect{playlist.delete}.to fail.with 'forbidden' }
75
- it { expect{playlist.update}.to fail.with 'forbidden' }
62
+ it { expect{playlist.delete}.to fail.with 'playlistForbidden' }
63
+ it { expect{playlist.update}.to fail.with 'playlistForbidden' }
76
64
  it { expect{playlist.add_video! video_id}.to raise_error Yt::Errors::RequestError }
77
65
  it { expect{playlist.delete_playlist_items}.to raise_error Yt::Errors::RequestError }
78
66
  end
@@ -164,7 +152,7 @@ describe Yt::Playlist, :device_app do
164
152
  end
165
153
 
166
154
  context 'given an existing video' do
167
- let(:video_id) { 'MESycYJytkU' }
155
+ let(:video_id) { '9bZkp7q19f0' }
168
156
 
169
157
  describe 'can be added' do
170
158
  it { expect(playlist.add_video video_id).to be_a Yt::PlaylistItem }
@@ -206,18 +194,8 @@ describe Yt::Playlist, :device_app do
206
194
  end
207
195
  end
208
196
 
209
- context 'given a video of a terminated account' do
210
- let(:video_id) { 'kDCpdKeTe5g' }
211
-
212
- describe 'cannot be added' do
213
- it { expect(playlist.add_video video_id).to be_nil }
214
- it { expect{playlist.add_video video_id}.not_to change{playlist.playlist_items.count} }
215
- it { expect{playlist.add_video! video_id}.to fail.with 'forbidden' }
216
- end
217
- end
218
-
219
197
  context 'given one existing and one unknown video' do
220
- let(:video_ids) { ['MESycYJytkU', 'not-a-video'] }
198
+ let(:video_ids) { ['9bZkp7q19f0', 'not-a-video'] }
221
199
 
222
200
  describe 'only one can be added' do
223
201
  it { expect(playlist.add_videos(video_ids).length).to eq 2 }
@@ -235,11 +213,6 @@ describe Yt::Playlist, :device_app do
235
213
  expect{playlist.playlist_starts}.not_to raise_error
236
214
  expect{playlist.average_time_in_playlist}.not_to raise_error
237
215
  expect{playlist.views_per_playlist_start}.not_to raise_error
238
-
239
- expect{playlist.views_on 3.days.ago}.not_to raise_error
240
- expect{playlist.playlist_starts_on 3.days.ago}.not_to raise_error
241
- expect{playlist.average_time_in_playlist_on 3.days.ago}.not_to raise_error
242
- expect{playlist.views_per_playlist_start_on 3.days.ago}.not_to raise_error
243
216
  end
244
217
  end
245
218
  end
@@ -7,7 +7,7 @@ describe Yt::Video, :device_app do
7
7
  subject(:video) { Yt::Video.new id: id, auth: $account }
8
8
 
9
9
  context 'given someone else’s video' do
10
- let(:id) { 'MESycYJytkU' }
10
+ let(:id) { '9bZkp7q19f0' }
11
11
 
12
12
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
13
13
 
@@ -310,21 +310,6 @@ describe Yt::Video, :device_app do
310
310
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
311
311
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
312
312
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
313
-
314
- expect{video.views_on 3.days.ago}.not_to raise_error
315
- expect{video.comments_on 3.days.ago}.not_to raise_error
316
- expect{video.likes_on 3.days.ago}.not_to raise_error
317
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
318
- expect{video.shares_on 3.days.ago}.not_to raise_error
319
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
320
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
321
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
322
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
323
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
324
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
325
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
326
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
327
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
328
313
  end
329
314
  end
330
315
 
@@ -433,7 +418,7 @@ describe Yt::Video, :device_app do
433
418
  subject(:video) { Yt::Video.new id: id, auth: $account }
434
419
 
435
420
  context 'given someone else’s video' do
436
- let(:id) { 'MESycYJytkU' }
421
+ let(:id) { '9bZkp7q19f0' }
437
422
 
438
423
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
439
424
 
@@ -730,21 +715,6 @@ describe Yt::Video, :device_app do
730
715
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
731
716
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
732
717
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
733
-
734
- expect{video.views_on 3.days.ago}.not_to raise_error
735
- expect{video.comments_on 3.days.ago}.not_to raise_error
736
- expect{video.likes_on 3.days.ago}.not_to raise_error
737
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
738
- expect{video.shares_on 3.days.ago}.not_to raise_error
739
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
740
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
741
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
742
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
743
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
744
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
745
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
746
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
747
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
748
718
  end
749
719
  end
750
720
 
@@ -853,7 +823,7 @@ describe Yt::Video, :device_app do
853
823
  subject(:video) { Yt::Video.new id: id, auth: $account }
854
824
 
855
825
  context 'given someone else’s video' do
856
- let(:id) { 'MESycYJytkU' }
826
+ let(:id) { '9bZkp7q19f0' }
857
827
 
858
828
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
859
829
 
@@ -1080,25 +1050,6 @@ describe Yt::Video, :device_app do
1080
1050
  end
1081
1051
  end
1082
1052
 
1083
- context 'given I update the embeddable status' do
1084
- let!(:old_embeddable) { video.embeddable? }
1085
- let!(:new_embeddable) { !old_embeddable }
1086
-
1087
- let(:attrs) { {embeddable: new_embeddable} }
1088
-
1089
- # @note: This test is a reflection of another irrational behavior of
1090
- # YouTube API. Although 'embeddable' can be passed as an 'update'
1091
- # attribute according to the documentation, it simply does not work.
1092
- # The day YouTube fixes it, then this test will finally fail and will
1093
- # be removed, documenting how to update 'embeddable' too.
1094
- # @see https://developers.google.com/youtube/v3/docs/videos/update
1095
- # @see https://code.google.com/p/gdata-issues/issues/detail?id=4861
1096
- specify 'does not update the embeddable status' do
1097
- expect(update).to be true
1098
- expect(video.embeddable?).to eq old_embeddable
1099
- end
1100
- end
1101
-
1102
1053
  context 'given I update the public stats viewable setting' do
1103
1054
  let!(:old_public_stats_viewable) { video.has_public_stats_viewable? }
1104
1055
  let!(:new_public_stats_viewable) { !old_public_stats_viewable }
@@ -1150,21 +1101,6 @@ describe Yt::Video, :device_app do
1150
1101
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
1151
1102
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
1152
1103
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
1153
-
1154
- expect{video.views_on 3.days.ago}.not_to raise_error
1155
- expect{video.comments_on 3.days.ago}.not_to raise_error
1156
- expect{video.likes_on 3.days.ago}.not_to raise_error
1157
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
1158
- expect{video.shares_on 3.days.ago}.not_to raise_error
1159
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
1160
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
1161
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
1162
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
1163
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
1164
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
1165
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
1166
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
1167
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
1168
1104
  end
1169
1105
  end
1170
1106
 
@@ -1273,7 +1209,7 @@ describe Yt::Video, :device_app do
1273
1209
  subject(:video) { Yt::Video.new id: id, auth: $account }
1274
1210
 
1275
1211
  context 'given someone else’s video' do
1276
- let(:id) { 'MESycYJytkU' }
1212
+ let(:id) { '9bZkp7q19f0' }
1277
1213
 
1278
1214
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
1279
1215
 
@@ -1570,21 +1506,6 @@ describe Yt::Video, :device_app do
1570
1506
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
1571
1507
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
1572
1508
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
1573
-
1574
- expect{video.views_on 3.days.ago}.not_to raise_error
1575
- expect{video.comments_on 3.days.ago}.not_to raise_error
1576
- expect{video.likes_on 3.days.ago}.not_to raise_error
1577
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
1578
- expect{video.shares_on 3.days.ago}.not_to raise_error
1579
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
1580
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
1581
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
1582
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
1583
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
1584
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
1585
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
1586
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
1587
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
1588
1509
  end
1589
1510
  end
1590
1511
 
@@ -1693,7 +1614,7 @@ describe Yt::Video, :device_app do
1693
1614
  subject(:video) { Yt::Video.new id: id, auth: $account }
1694
1615
 
1695
1616
  context 'given someone else’s video' do
1696
- let(:id) { 'MESycYJytkU' }
1617
+ let(:id) { '9bZkp7q19f0' }
1697
1618
 
1698
1619
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
1699
1620
 
@@ -1991,20 +1912,6 @@ describe Yt::Video, :device_app do
1991
1912
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
1992
1913
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
1993
1914
 
1994
- expect{video.views_on 3.days.ago}.not_to raise_error
1995
- expect{video.comments_on 3.days.ago}.not_to raise_error
1996
- expect{video.likes_on 3.days.ago}.not_to raise_error
1997
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
1998
- expect{video.shares_on 3.days.ago}.not_to raise_error
1999
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
2000
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
2001
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
2002
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
2003
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
2004
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
2005
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
2006
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
2007
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
2008
1915
  end
2009
1916
  end
2010
1917
 
@@ -2113,7 +2020,7 @@ describe Yt::Video, :device_app do
2113
2020
  subject(:video) { Yt::Video.new id: id, auth: $account }
2114
2021
 
2115
2022
  context 'given someone else’s video' do
2116
- let(:id) { 'MESycYJytkU' }
2023
+ let(:id) { '9bZkp7q19f0' }
2117
2024
 
2118
2025
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
2119
2026
 
@@ -2410,21 +2317,6 @@ describe Yt::Video, :device_app do
2410
2317
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
2411
2318
  expect{video.playback_based_cpm}.to raise_error Yt::Errors::Unauthorized
2412
2319
  expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
2413
-
2414
- expect{video.views_on 3.days.ago}.not_to raise_error
2415
- expect{video.comments_on 3.days.ago}.not_to raise_error
2416
- expect{video.likes_on 3.days.ago}.not_to raise_error
2417
- expect{video.dislikes_on 3.days.ago}.not_to raise_error
2418
- expect{video.shares_on 3.days.ago}.not_to raise_error
2419
- expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
2420
- expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
2421
- expect{video.videos_added_to_playlists_on 3.days.ago}.not_to raise_error
2422
- expect{video.videos_removed_from_playlists_on 3.days.ago}.not_to raise_error
2423
- expect{video.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
2424
- expect{video.average_view_duration_on 3.days.ago}.not_to raise_error
2425
- expect{video.average_view_percentage_on 3.days.ago}.not_to raise_error
2426
- expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
2427
- expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
2428
2320
  end
2429
2321
  end
2430
2322
 
@@ -130,21 +130,6 @@ describe Yt::Channel, :partner do
130
130
  shares: Integer, playback_based_cpm: Float,
131
131
  monetized_playbacks: Integer, annotation_close_rate: Float,
132
132
  earnings: Float}.each do |metric, type|
133
- describe "#{metric} can be retrieved for a specific day" do
134
- let(:metric) { metric }
135
- let(:result) { channel.public_send "#{metric}_on", date }
136
-
137
- context 'in which the channel had data for the report' do
138
- let(:date) { Date.parse(ENV['YT_TEST_PARTNER_VIDEO_DATE']) + 95 }
139
- it { expect(result).to be_a type }
140
- end
141
-
142
- context 'in which the channel was not partnered' do
143
- let(:date) { 5.days.from_now }
144
- it { expect(result).to be_nil }
145
- end
146
- end
147
-
148
133
  describe "#{metric} can be grouped by range" do
149
134
  let(:metric) { metric }
150
135
 
@@ -100,21 +100,6 @@ describe Yt::Playlist, :partner do
100
100
  end
101
101
  end
102
102
 
103
- describe "#{metric} can be retrieved for a specific day" do
104
- let(:metric) { metric }
105
- let(:result) { playlist.public_send "#{metric}_on", date }
106
-
107
- context 'in which the playlist had data' do
108
- let(:date) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
109
- it { expect(result).to be_a type }
110
- end
111
-
112
- context 'in the future' do
113
- let(:date) { 5.days.from_now }
114
- it { expect(result).to be_nil }
115
- end
116
- end
117
-
118
103
  describe "#{metric} can be grouped by range" do
119
104
  let(:metric) { metric }
120
105
 
@@ -90,27 +90,6 @@ describe Yt::Video, :partner do
90
90
  end
91
91
  end
92
92
 
93
- {views: Integer, comments: Integer, dislikes: Integer,
94
- estimated_minutes_watched: Integer, average_view_duration: Integer,
95
- average_view_percentage: Float, impressions: Integer,
96
- subscribers_lost: Integer, subscribers_gained: Integer, likes: Integer,
97
- monetized_playbacks: Integer, earnings: Float}.each do |metric, type|
98
- describe "#{metric} can be retrieved for a specific day" do
99
- let(:metric) { metric }
100
- let(:result) { video.public_send "#{metric}_on", date }
101
-
102
- context 'in which the video had data' do
103
- let(:date) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
104
- it { expect(result).to be_a type }
105
- end
106
-
107
- context 'in the future' do
108
- let(:date) { 5.days.from_now }
109
- it { expect(result).to be_nil }
110
- end
111
- end
112
- end
113
-
114
93
  {views: Integer, comments: Integer, likes: Integer, dislikes: Integer,
115
94
  shares: Integer, subscribers_gained: Integer, subscribers_lost: Integer,
116
95
  videos_added_to_playlists: Integer, videos_removed_from_playlists: Integer,
@@ -19,10 +19,4 @@ describe Yt::Comment, :server_app do
19
19
 
20
20
  it { expect(comment.parent_id).to be_a String }
21
21
  end
22
-
23
- context 'given an unknown comment ID' do
24
- let(:attrs) { {id: 'not-a-comment-id'} }
25
- it { expect{comment.text_display}.to raise_error Yt::Errors::NoItems }
26
- end
27
-
28
22
  end
@@ -6,7 +6,7 @@ describe Yt::CommentThread, :server_app do
6
6
  subject(:comment_thread) { Yt::CommentThread.new attrs }
7
7
 
8
8
  context 'given an existing comment thread ID about a channel' do
9
- let(:attrs) { {id: 'z13vsnnbwtv4sbnug232erczcmi3wzaug'} }
9
+ let(:attrs) { {id: 'z13kdnf4pursxnwr404cc3oz4zb0hjwirkg0k'} }
10
10
 
11
11
  it { expect(comment_thread.video_id).to be_nil }
12
12
  it { expect(comment_thread.total_reply_count).to be_an Integer }
@@ -21,13 +21,7 @@ describe Yt::CommentThread, :server_app do
21
21
  end
22
22
 
23
23
  context 'given an comment thread ID about a video' do
24
- let(:attrs) { {id: 'z13ij10h2z3qxpcte23hc5oh2vfzeptk4'} }
24
+ let(:attrs) { {id: 'z134e1gyav3qt3nnr22phjeavv2zdfef0'} }
25
25
  it { expect(comment_thread.video_id).to be_a String }
26
26
  end
27
-
28
- context 'given an unknown comment thread ID' do
29
- let(:attrs) { {id: 'not-a-comment-thread-id'} }
30
- it { expect{comment_thread.total_reply_count}.to raise_error Yt::Errors::NoItems }
31
- end
32
-
33
27
  end
@@ -5,7 +5,7 @@ describe Yt::PlaylistItem, :server_app do
5
5
  subject(:item) { Yt::PlaylistItem.new id: id }
6
6
 
7
7
  context 'given an existing playlist item' do
8
- let(:id) { 'PLjW_GNR5Ir0GMlbJzA-aW0UV8TchJFb8p3uzrLNcZKPY' }
8
+ let(:id) { 'UExTV1lrWXpPclBNVDlwSkc1U3Q1RzBXRGFsaFJ6R2tVNC4yQUE2Q0JEMTk4NTM3RTZC' }
9
9
 
10
10
  it 'returns valid snippet data' do
11
11
  expect(item.snippet).to be_a Yt::Snippet
@@ -6,7 +6,7 @@ describe Yt::Video, :server_app do
6
6
  subject(:video) { Yt::Video.new attrs }
7
7
 
8
8
  context 'given an existing video ID' do
9
- let(:attrs) { {id: 'L3JDXvz7G6c'} }
9
+ let(:attrs) { {id: '9bZkp7q19f0'} }
10
10
 
11
11
  it { expect(video.content_detail).to be_a Yt::ContentDetail }
12
12
 
@@ -28,11 +28,11 @@ describe Yt::Video, :server_app do
28
28
  end
29
29
 
30
30
  context 'given an existing video URL' do
31
- let(:attrs) { {url: 'https://www.youtube.com/watch?v=L3JDXvz7G6c'} }
31
+ let(:attrs) { {url: 'https://www.youtube.com/watch?v=9bZkp7q19f0'} }
32
32
 
33
33
  specify 'provides access to its data' do
34
- expect(video.id).to eq 'L3JDXvz7G6c'
35
- expect(video.title).to eq "you’re in fullscreen"
34
+ expect(video.id).to eq '9bZkp7q19f0'
35
+ expect(video.title).to eq "PSY - GANGNAM STYLE(강남스타일) M/V"
36
36
  expect(video.privacy_status).to eq 'public'
37
37
  end
38
38
  end
@@ -14,7 +14,7 @@ describe Yt::Collections::Videos, :server_app do
14
14
  end
15
15
 
16
16
  context 'with a list of video IDs, only returns the videos matching those IDs' do
17
- let(:video_id) { 'MESycYJytkU' }
17
+ let(:video_id) { '9bZkp7q19f0' }
18
18
  let(:videos_by_id) { videos.where id: "#{video_id},invalid" }
19
19
 
20
20
  it { expect(videos_by_id.size).to be 1 }
@@ -26,9 +26,9 @@ describe Yt::Collections::Videos, :server_app do
26
26
  end
27
27
 
28
28
  context 'with a list of parts' do
29
- let(:video_id) { 'MESycYJytkU' }
29
+ let(:video_id) { '9bZkp7q19f0' }
30
30
  let(:part) { 'statistics,contentDetails' }
31
- let(:video) { videos.where(id: 'MESycYJytkU', part: part).first }
31
+ let(:video) { videos.where(id: '9bZkp7q19f0', part: part).first }
32
32
 
33
33
  specify 'load ONLY the specified parts of the videos' do
34
34
  expect(video.instance_variable_defined? :@snippet).to be false
@@ -5,18 +5,10 @@ describe Yt::Video do
5
5
  subject(:video) { Yt::Video.new id: id }
6
6
 
7
7
  context 'given a public video with annotations' do
8
- let(:id) { 'MESycYJytkU' }
8
+ let(:id) { '9bZkp7q19f0' }
9
9
 
10
10
  it { expect(video.annotations).to be_a Yt::Collections::Annotations }
11
11
  it { expect(video.annotations.first).to be_a Yt::Annotation }
12
12
  it { expect(video.annotations.size).to be > 0 }
13
13
  end
14
-
15
- context 'given a private video' do
16
- let(:id) { 'JzDEc54FVTc' }
17
-
18
- it { expect(video.annotations).to be_a Yt::Collections::Annotations }
19
- it { expect(video.annotations.count).to be_zero }
20
- it { expect(video.annotations.size).to be_zero }
21
- end
22
14
  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.26.3
4
+ version: 0.27.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: 2016-10-07 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport