yt 0.11.6 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +13 -2
  4. data/lib/yt/actions/list.rb +11 -1
  5. data/lib/yt/associations/has_attribute.rb +51 -0
  6. data/lib/yt/associations/has_many.rb +0 -15
  7. data/lib/yt/collections/content_owners.rb +0 -4
  8. data/lib/yt/collections/playlist_items.rb +1 -1
  9. data/lib/yt/collections/resources.rb +1 -1
  10. data/lib/yt/collections/subscribed_channels.rb +46 -0
  11. data/lib/yt/collections/subscribers.rb +33 -0
  12. data/lib/yt/collections/subscriptions.rb +0 -23
  13. data/lib/yt/models/account.rb +6 -1
  14. data/lib/yt/models/annotation.rb +4 -10
  15. data/lib/yt/models/asset.rb +3 -10
  16. data/lib/yt/models/base.rb +2 -0
  17. data/lib/yt/models/channel.rb +53 -25
  18. data/lib/yt/models/claim.rb +13 -25
  19. data/lib/yt/models/content_detail.rb +9 -11
  20. data/lib/yt/models/content_owner_detail.rb +2 -8
  21. data/lib/yt/models/device_flow.rb +3 -11
  22. data/lib/yt/models/live_streaming_detail.rb +5 -25
  23. data/lib/yt/models/ownership.rb +8 -8
  24. data/lib/yt/models/playlist.rb +14 -10
  25. data/lib/yt/models/playlist_item.rb +13 -0
  26. data/lib/yt/models/policy.rb +10 -14
  27. data/lib/yt/models/policy_rule.rb +15 -21
  28. data/lib/yt/models/reference.rb +13 -37
  29. data/lib/yt/models/right_owner.rb +6 -17
  30. data/lib/yt/models/snippet.rb +19 -33
  31. data/lib/yt/models/statistics_set.rb +9 -23
  32. data/lib/yt/models/status.rb +20 -25
  33. data/lib/yt/models/subscription.rb +2 -8
  34. data/lib/yt/models/user_info.rb +11 -33
  35. data/lib/yt/version.rb +1 -1
  36. data/spec/collections/subscriptions_spec.rb +0 -7
  37. data/spec/errors/forbidden_spec.rb +10 -0
  38. data/spec/errors/server_error_spec.rb +10 -0
  39. data/spec/models/subscription_spec.rb +0 -9
  40. data/spec/requests/as_account/account_spec.rb +8 -0
  41. data/spec/requests/as_account/channel_spec.rb +40 -6
  42. data/spec/requests/as_account/playlist_item_spec.rb +26 -0
  43. data/spec/requests/as_account/playlist_spec.rb +1 -0
  44. data/spec/requests/as_server_app/channel_spec.rb +9 -0
  45. metadata +9 -2
@@ -134,6 +134,7 @@ describe Yt::Playlist, :device_app do
134
134
  it { expect{playlist.add_video video_id}.to change{playlist.playlist_items.count}.by(1) }
135
135
  it { expect(playlist.add_video! video_id).to be_a Yt::PlaylistItem }
136
136
  it { expect{playlist.add_video! video_id}.to change{playlist.playlist_items.count}.by(1) }
137
+ it { expect(playlist.add_video(video_id, position: 0).position).to be 0 }
137
138
  end
138
139
 
139
140
  describe 'can be removed' do
@@ -21,6 +21,15 @@ describe Yt::Channel, :server_app do
21
21
  it { expect(channel.videos.first).to be_a Yt::Video }
22
22
  it { expect(channel.playlists).to be_a Yt::Collections::Playlists }
23
23
  it { expect(channel.playlists.first).to be_a Yt::Playlist }
24
+
25
+ specify 'with a public list of subscriptions' do
26
+ expect(channel.subscribed_channels.first).to be_a Yt::Channel
27
+ end
28
+
29
+ context 'with a hidden list of subscriptions' do
30
+ let(:id) { 'UCG0hw7n_v0sr8MXgb6oel6w' }
31
+ it { expect{channel.subscribed_channels.size}.to raise_error Yt::Errors::Forbidden }
32
+ end
24
33
  end
25
34
 
26
35
  context 'given an unknown channel' do
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.11.6
4
+ version: 0.12.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: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -124,6 +124,7 @@ files:
124
124
  - lib/yt/actions/modify.rb
125
125
  - lib/yt/actions/patch.rb
126
126
  - lib/yt/actions/update.rb
127
+ - lib/yt/associations/has_attribute.rb
127
128
  - lib/yt/associations/has_authentication.rb
128
129
  - lib/yt/associations/has_many.rb
129
130
  - lib/yt/associations/has_one.rb
@@ -154,6 +155,8 @@ files:
154
155
  - lib/yt/collections/snippets.rb
155
156
  - lib/yt/collections/statistics_sets.rb
156
157
  - lib/yt/collections/statuses.rb
158
+ - lib/yt/collections/subscribed_channels.rb
159
+ - lib/yt/collections/subscribers.rb
157
160
  - lib/yt/collections/subscriptions.rb
158
161
  - lib/yt/collections/user_infos.rb
159
162
  - lib/yt/collections/videos.rb
@@ -210,9 +213,11 @@ files:
210
213
  - spec/collections/references_spec.rb
211
214
  - spec/collections/subscriptions_spec.rb
212
215
  - spec/collections/videos_spec.rb
216
+ - spec/errors/forbidden_spec.rb
213
217
  - spec/errors/missing_auth_spec.rb
214
218
  - spec/errors/no_items_spec.rb
215
219
  - spec/errors/request_error_spec.rb
220
+ - spec/errors/server_error_spec.rb
216
221
  - spec/errors/unauthorized_spec.rb
217
222
  - spec/models/account_spec.rb
218
223
  - spec/models/annotation_spec.rb
@@ -301,9 +306,11 @@ test_files:
301
306
  - spec/collections/references_spec.rb
302
307
  - spec/collections/subscriptions_spec.rb
303
308
  - spec/collections/videos_spec.rb
309
+ - spec/errors/forbidden_spec.rb
304
310
  - spec/errors/missing_auth_spec.rb
305
311
  - spec/errors/no_items_spec.rb
306
312
  - spec/errors/request_error_spec.rb
313
+ - spec/errors/server_error_spec.rb
307
314
  - spec/errors/unauthorized_spec.rb
308
315
  - spec/models/account_spec.rb
309
316
  - spec/models/annotation_spec.rb