yt 0.33.3 → 0.33.4

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: a8fb2f8f84d6a6ce2ec3b7cf3afae4152820f6ef62a1229f4b512bc87a913efd
4
- data.tar.gz: 46d4c3b5a3a5e01bd1366f4679cb2c4e1db08e667d64a6b003e01f8f91cde5c3
3
+ metadata.gz: 8c89bfab3bb32975237aa1b79a1f0897a240ea494f3d3928a03b423c734b71f6
4
+ data.tar.gz: 6c58ab20408d9fdf79265fc499d1ee0f88623295de50592a25948e8029aaf91a
5
5
  SHA512:
6
- metadata.gz: 9021e2cd657badc5446c118a82f7e392d75a513c42f5f1f9664d2dd3ce1da5274b9edb8e89fca67189f0011ab447c13edd102ccc1677d2f5ee5e567accc23d54
7
- data.tar.gz: 59b673686f5c0faf8c21e155110fa3371f5d5cc2b020bf27189c1e2e50b9b05f4a51860186887e8444c6d1da33b057d260ae7f1d696eb97717b362174abe479d
6
+ metadata.gz: 2bcd96aa69c14456e067f0cad222148743334e8d8f89f3a052923f687e2d06e3a53db772898ec43399d1cdff20352fc9e56f63745bdbbebe69641511255cf5a9
7
+ data.tar.gz: 52245373b815ad681f7516bea9157597c7b5b118db206a50c7ca2746cf61b8c591f2fb4765c63787427cac26fb803ce11053c1d12855e4d213fdbfb54b372e0c
@@ -6,6 +6,10 @@ 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.33.4 - 2021-01-15
10
+
11
+ * [REMOVAL] remove retry for quota errors
12
+
9
13
  ## 0.33.3 - 2020-11-17
10
14
 
11
15
  * [BUGFIX] require the `URL` model when requiring `yt`
@@ -67,13 +67,19 @@ module Yt
67
67
  # @option params [String] :description The video’s description.
68
68
  # @option params [Array<String>] :tags The video’s tags.
69
69
  # @option params [String] :privacy_status The video’s privacy status.
70
+ # @option params [Boolean] :self_declared_made_for_kids The video’s made for kids self-declaration.
70
71
  # @return [Yt::Models::Video] the newly uploaded video.
71
72
  def upload_video(path_or_url, params = {})
72
73
  file = open path_or_url, 'rb'
73
74
  session = resumable_sessions.insert file.size, upload_body(params)
74
75
 
75
76
  session.update(body: file) do |data|
76
- Yt::Video.new id: data['id'], snippet: data['snippet'], status: data['privacyStatus'], auth: self
77
+ Yt::Video.new(
78
+ id: data['id'],
79
+ snippet: data['snippet'],
80
+ status: data['status'],
81
+ auth: self
82
+ )
77
83
  end
78
84
  end
79
85
 
@@ -217,8 +223,12 @@ module Yt
217
223
  snippet[:categoryId] = snippet.delete(:category_id) if snippet[:category_id]
218
224
  body[:snippet] = snippet if snippet.any?
219
225
 
220
- status = params[:privacy_status]
221
- body[:status] = {privacyStatus: status} if status
226
+ privacy_status = params[:privacy_status]
227
+ self_declared_made_for_kids = params[:self_declared_made_for_kids]
228
+
229
+ body[:status] = {}
230
+ body[:status][:privacyStatus] = privacy_status if privacy_status
231
+ body[:status][:selfDeclaredMadeForKids] = self_declared_made_for_kids unless self_declared_made_for_kids.nil?
222
232
  end
223
233
  end
224
234
 
@@ -29,6 +29,25 @@ module Yt
29
29
  # @return [Time] the date and time that the channel was created.
30
30
  delegate :published_at, to: :snippet
31
31
 
32
+ ### STATUS ###
33
+
34
+ # @!attribute [r] made_for_kids?
35
+ # @return [Boolean, nil] This value indicates whether the channel is
36
+ # designated as child-directed, and it contains the current "made for
37
+ # kids" status of the channel.
38
+ def made_for_kids?
39
+ status.made_for_kids
40
+ end
41
+
42
+ # @!attribute [r] self_declared_made_for_kids?
43
+ # @return [Boolean, nil] In a channels.update request, this property
44
+ # allows the channel owner to designate the channel as
45
+ # child-directed. The property value is only returned if the channel
46
+ # owner authorized the API request.
47
+ def self_declared_made_for_kids?
48
+ status.self_declared_made_for_kids
49
+ end
50
+
32
51
  ### SUBSCRIPTION ###
33
52
 
34
53
  has_one :subscription
@@ -27,6 +27,8 @@ module Yt
27
27
  has_attribute :embeddable
28
28
  has_attribute :public_stats_viewable
29
29
  has_attribute :publish_at, type: Time
30
+ has_attribute :made_for_kids
31
+ has_attribute :self_declared_made_for_kids
30
32
  end
31
33
  end
32
- end
34
+ end
@@ -223,6 +223,21 @@ module Yt
223
223
  status.embeddable
224
224
  end
225
225
 
226
+ # @return [Boolean, nil] This value indicates whether the video is
227
+ # designated as child-directed, and it contains the current "made for
228
+ # kids" status of the video.
229
+ def made_for_kids?
230
+ status.made_for_kids
231
+ end
232
+
233
+ # @return [Boolean, nil] In a videos.insert or videos.update request,
234
+ # this property allows the channel owner to designate the video as
235
+ # being child-directed. In a videos.list request, the property value
236
+ # is only returned if the channel owner authorized the API request.
237
+ def self_declared_made_for_kids?
238
+ status.self_declared_made_for_kids
239
+ end
240
+
226
241
  ### CONTENT DETAILS ###
227
242
 
228
243
  has_one :content_detail
@@ -667,7 +682,7 @@ module Yt
667
682
  snippet_keys = [:title, :description, :tags, :category_id]
668
683
  snippet = {keys: snippet_keys, sanitize_brackets: true}
669
684
  status_keys = [:privacy_status, :embeddable, :license,
670
- :public_stats_viewable, :publish_at]
685
+ :public_stats_viewable, :publish_at, :self_declared_made_for_kids]
671
686
  {snippet: snippet, status: {keys: status_keys}}
672
687
  end
673
688
 
@@ -197,8 +197,7 @@ module Yt
197
197
  # for a couple of seconds might solve the connection issues.
198
198
  def run_again?
199
199
  refresh_token_and_retry? && sleep_and_retry?(1) ||
200
- server_error? && sleep_and_retry?(3) ||
201
- exceeded_quota? && sleep_and_retry?(3)
200
+ server_error? && sleep_and_retry?(3)
202
201
  end
203
202
 
204
203
  # Returns the list of server errors worth retrying the request once.
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.33.3'
2
+ VERSION = '0.33.4'
3
3
  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.33.3
4
+ version: 0.33.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -279,7 +279,7 @@ homepage: http://github.com/Fullscreen/yt
279
279
  licenses:
280
280
  - MIT
281
281
  metadata: {}
282
- post_install_message:
282
+ post_install_message:
283
283
  rdoc_options: []
284
284
  require_paths:
285
285
  - lib
@@ -294,8 +294,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  requirements: []
297
- rubygems_version: 3.1.4
298
- signing_key:
297
+ rubygems_version: 3.1.2
298
+ signing_key:
299
299
  specification_version: 4
300
300
  summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,
301
301
  intuitive and tested Ruby-style API.