yt 0.32.5 → 0.32.6

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
  SHA256:
3
- metadata.gz: 3d1e942d9a105cfd41c9fcce6295f2ff433a8ab432e2d7e6084e0e8f9627f6ee
4
- data.tar.gz: 8f73301f471b3a9d0ae55ef0ef5389551d8d67000b7a1a4fa305ecb7a1686743
3
+ metadata.gz: e19662ddb23d57f544dd42ab0ceb974e0cf7b7a0aadb2137a298c9a5f0afe2cf
4
+ data.tar.gz: c02517119190c7eda5f532305330b148979ca2bd04b38485915717fb41c5125c
5
5
  SHA512:
6
- metadata.gz: b9289ffa8d210d2c79753a75273e4a8ba6224a66e2df9806cc82103d20958687b691c4410a2b4da6ec77267eb22459362219fcf744d44dda47c32fa19891c5a6
7
- data.tar.gz: e561898b7f286c9bba3d81d1e4ffb1bd1e595647127d04e0d586917af39a5c1e7f65572a354fb45244d354f3184f07a2fb52c9f24604a53ee3b5ea3106a29c91
6
+ metadata.gz: 3d19c4c4c947855487e23d07fd89f6b11719af3cb11b8bc3d73594f4703be7f7990652050ac03449359d6861be02cd43eea2599839e2f9b8c0f304449bf084cf
7
+ data.tar.gz: d794dfbbe1eddcaa98bf0ec0daa36983b7e69b97c8aafa060418999ed5a5806dbf3bbec18fe772a2383f28033f87b8f1364c4742f74abdc6b1a201a1209935a4
@@ -7,6 +7,14 @@ For more information about changelogs, check
7
7
  [Vandamme](http://tech-angels.github.io/vandamme).
8
8
 
9
9
 
10
+ ## 0.32.6 - 2020-02-07
11
+
12
+ * [FEATURE] Allow partnered channels to delete playlist item.
13
+ * [FEATURE] Allow partnered channels to update video.
14
+ * [FEATURE] Allow partnered channels to update playlist.
15
+ * [FEATURE] Allow partnered channels to upload thumbnail.
16
+ * [FEATURE] Allow partnered channels to create playlist item.
17
+
10
18
  ## 0.32.5 - 2019-11-06
11
19
 
12
20
  * [BUGFIX] Fix `MatchPolicy#update` and `Asset#update` by using `PUT` instead of `PATCH`
@@ -48,6 +48,15 @@ module Yt
48
48
  def insert_parts
49
49
  {snippet: {keys: [:playlist_id, :resource_id, :position]}}
50
50
  end
51
+
52
+ # For inserting a playlist item with content owner auth.
53
+ # @see https://developers.google.com/youtube/v3/docs/playlistItems/insert
54
+ def insert_params
55
+ params = super
56
+ params[:params] ||= {}
57
+ params[:params].merge! @auth.insert_playlist_item_params
58
+ params
59
+ end
51
60
  end
52
61
  end
53
- end
62
+ end
@@ -192,6 +192,10 @@ module Yt
192
192
  {mine: true}
193
193
  end
194
194
 
195
+ def playlist_items_params
196
+ {}
197
+ end
198
+
195
199
  # @private
196
200
  # Tells `has_many :resumable_sessions` what path to hit to upload a file.
197
201
  def upload_path
@@ -223,6 +227,22 @@ module Yt
223
227
  def upload_content_type
224
228
  'video/*'
225
229
  end
230
+
231
+ def update_video_params
232
+ {}
233
+ end
234
+
235
+ def update_playlist_params
236
+ {}
237
+ end
238
+
239
+ def upload_thumbnail_params
240
+ {}
241
+ end
242
+
243
+ def insert_playlist_item_params
244
+ {}
245
+ end
226
246
  end
227
247
  end
228
248
  end
@@ -283,7 +283,8 @@ module Yt
283
283
  # @private
284
284
  # Tells `has_reports` to retrieve the reports from YouTube Analytics API
285
285
  # either as a Channel or as a Content Owner.
286
- # @see https://developers.google.com/youtube/analytics/v1/reports
286
+ # @see https://developers.google.com/youtube/analytics/channel_reports
287
+ # @see https://developers.google.com/youtube/analytics/content_owner_reports
287
288
  def reports_params
288
289
  {}.tap do |params|
289
290
  if auth.owner_name
@@ -102,6 +102,26 @@ module Yt
102
102
  def video_groups_params
103
103
  {on_behalf_of_content_owner: @owner_name}
104
104
  end
105
+
106
+ def playlist_items_params
107
+ {on_behalf_of_content_owner: @owner_name}
108
+ end
109
+
110
+ def update_video_params
111
+ {on_behalf_of_content_owner: @owner_name}
112
+ end
113
+
114
+ def update_playlist_params
115
+ {on_behalf_of_content_owner: @owner_name}
116
+ end
117
+
118
+ def upload_thumbnail_params
119
+ {on_behalf_of_content_owner: @owner_name}
120
+ end
121
+
122
+ def insert_playlist_item_params
123
+ {on_behalf_of_content_owner: @owner_name}
124
+ end
105
125
  end
106
126
  end
107
127
  end
@@ -197,7 +197,8 @@ module Yt
197
197
  # @private
198
198
  # Tells `has_reports` to retrieve the reports from YouTube Analytics API
199
199
  # either as a Channel or as a Content Owner.
200
- # @see https://developers.google.com/youtube/analytics/v1/reports
200
+ # @see https://developers.google.com/youtube/analytics/channel_reports
201
+ # @see https://developers.google.com/youtube/analytics/content_owner_reports
201
202
  def reports_params
202
203
  {}.tap do |params|
203
204
  if auth.owner_name
@@ -231,6 +232,15 @@ module Yt
231
232
  params[:resource_id] ||= {kind: 'youtube#video', videoId: video_id}
232
233
  end
233
234
  end
235
+
236
+ # For updating playlist with content owner auth.
237
+ # @see https://developers.google.com/youtube/v3/docs/playlists/update
238
+ def update_params
239
+ params = super
240
+ params[:params] ||= {}
241
+ params[:params].merge! auth.update_playlist_params
242
+ params
243
+ end
234
244
  end
235
245
  end
236
- end
246
+ end
@@ -101,6 +101,13 @@ module Yt
101
101
  {kind: 'youtube#video', videoId: video_id}
102
102
  end
103
103
 
104
+ def delete_params
105
+ super.tap do |params|
106
+ params[:params] ||= {}
107
+ params[:params].merge! @auth.playlist_items_params
108
+ end
109
+ end
110
+
104
111
  # @see https://developers.google.com/youtube/v3/docs/playlistItems/update
105
112
  def update_parts
106
113
  keys = [:position, :playlist_id, :resource_id]
@@ -109,4 +116,4 @@ module Yt
109
116
  end
110
117
  end
111
118
  end
112
- end
119
+ end
@@ -6,6 +6,7 @@ module Yt
6
6
  # Encapsulates statistics about the resource, such as the number of times
7
7
  # the resource has been viewed or liked.
8
8
  # @see https://developers.google.com/youtube/v3/docs/videos#resource
9
+ # @see https://developers.google.com/youtube/v3/docs/channels#resource-representation
9
10
  class StatisticsSet < Base
10
11
  attr_reader :data
11
12
 
@@ -23,4 +24,4 @@ module Yt
23
24
  has_attribute :hidden_subscriber_count
24
25
  end
25
26
  end
26
- end
27
+ end
@@ -621,7 +621,8 @@ module Yt
621
621
  # @private
622
622
  # Tells `has_reports` to retrieve the reports from YouTube Analytics API
623
623
  # either as a Channel or as a Content Owner.
624
- # @see https://developers.google.com/youtube/analytics/v1/reports
624
+ # @see https://developers.google.com/youtube/analytics/channel_reports
625
+ # @see https://developers.google.com/youtube/analytics/content_owner_reports
625
626
  def reports_params
626
627
  {}.tap do |params|
627
628
  if auth.owner_name
@@ -642,8 +643,11 @@ module Yt
642
643
  # @private
643
644
  # Tells `has_many :resumable_sessions` what params are set for the object
644
645
  # associated to the uploaded file.
646
+ # https://developers.google.com/youtube/v3/docs/thumbnails/set
645
647
  def upload_params
646
- {video_id: id}
648
+ params = {video_id: id}
649
+ params.merge! auth.upload_thumbnail_params
650
+ params
647
651
  end
648
652
 
649
653
  # @private
@@ -667,6 +671,15 @@ module Yt
667
671
  {snippet: snippet, status: {keys: status_keys}}
668
672
  end
669
673
 
674
+ # For updating video with content owner auth.
675
+ # @see https://developers.google.com/youtube/v3/docs/videos/update
676
+ def update_params
677
+ params = super
678
+ params[:params] ||= {}
679
+ params[:params].merge! auth.update_video_params
680
+ params
681
+ end
682
+
670
683
  # NOTE: Another irrational behavior of YouTube API. If you are setting a
671
684
  # video to public/unlisted then you should *not* pass publishAt at any
672
685
  # cost, otherwise the API will fail (since setting publishAt means you
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.32.5'
2
+ VERSION = '0.32.6'
3
3
  end
@@ -1208,4 +1208,16 @@ describe Yt::Video, :partner do
1208
1208
  end
1209
1209
  end
1210
1210
  end
1211
+
1212
+ context 'given a video of a partnered channel' do
1213
+ let(:id) { 'kocTIjlZwGo' }
1214
+
1215
+ describe 'title can be updated' do
1216
+ let!(:old_title) { video.title }
1217
+ let!(:new_title) { old_title.reverse }
1218
+ before { video.update title: new_title }
1219
+ it { expect(video.title).to eq(new_title) }
1220
+ after { video.update title: old_title }
1221
+ end
1222
+ end
1211
1223
  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.32.5
4
+ version: 0.32.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2020-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -349,8 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  - !ruby/object:Gem::Version
350
350
  version: '0'
351
351
  requirements: []
352
- rubyforge_project:
353
- rubygems_version: 2.7.6.2
352
+ rubygems_version: 3.0.3
354
353
  signing_key:
355
354
  specification_version: 4
356
355
  summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,