yt 0.25.11 → 0.25.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/yt/models/video.rb +17 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_account/video_spec.rb +14 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01940dc4b5816dc744b2fce909ced888199db767
|
4
|
+
data.tar.gz: 984c537c33020c30df6b5c75f3cfdc1d24b65e6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f786eb0cb2f96ffd0f7f393eff9a59d1c1008b7a462ff6edacf75d7007b497cdff25087910d153ccc8e4d99a57252828a939a0beadef803f175a545d86d2a3d
|
7
|
+
data.tar.gz: 32b58752a0a18ecf3d35ae9756ec73193fcc0b3f5c192a0d11753a1cb578191812ca041a167df2850d24617cdbcaee31f645c59937a5a97957cc7c19fef74f6a
|
data/CHANGELOG.md
CHANGED
@@ -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.25.12 - 2015-12-03
|
10
|
+
|
11
|
+
* [BUGFIX] Fix Video#update with publishAt
|
12
|
+
|
9
13
|
## 0.25.11 - 2015-11-05
|
10
14
|
|
11
15
|
* [ENHANCEMENT] Add "youtube.com/v/..." as possible URL for YouTube videos
|
data/lib/yt/models/video.rb
CHANGED
@@ -631,6 +631,23 @@ module Yt
|
|
631
631
|
:public_stats_viewable, :publish_at]
|
632
632
|
{snippet: snippet, status: {keys: status_keys}}
|
633
633
|
end
|
634
|
+
|
635
|
+
# NOTE: Another irrational behavior of YouTube API. If you are setting a
|
636
|
+
# video to public/unlisted then you should *not* pass publishAt at any
|
637
|
+
# cost, otherwise the API will fail (since setting publishAt means you
|
638
|
+
# want the video to be private). Similarly, you should *not* pass any
|
639
|
+
# past publishAt (for the same reason).
|
640
|
+
def build_update_body_part(name, part, attributes = {})
|
641
|
+
{}.tap do |body_part|
|
642
|
+
part[:keys].map do |key|
|
643
|
+
body_part[camelize key] = attributes.fetch key, public_send(name).public_send(key)
|
644
|
+
end
|
645
|
+
|
646
|
+
if body_part.fetch(:publishAt, 1.day.from_now) < Time.now || body_part[:privacyStatus].in?(['public', 'unlisted'])
|
647
|
+
body_part.delete(:publishAt)
|
648
|
+
end
|
649
|
+
end
|
650
|
+
end
|
634
651
|
end
|
635
652
|
end
|
636
653
|
end
|
data/lib/yt/version.rb
CHANGED
@@ -337,7 +337,7 @@ describe Yt::Video, :device_app do
|
|
337
337
|
let(:id) { @tmp_video.id }
|
338
338
|
let!(:old_title) { "Yt Test Update publishAt Video #{rand}" }
|
339
339
|
let!(:old_privacy_status) { 'private' }
|
340
|
-
after { video.delete}
|
340
|
+
after { video.delete }
|
341
341
|
|
342
342
|
let!(:new_scheduled_at) { Yt::Timestamp.parse("#{rand(30) + 1} Jan 2020", Time.now) }
|
343
343
|
|
@@ -346,9 +346,21 @@ describe Yt::Video, :device_app do
|
|
346
346
|
|
347
347
|
specify 'only updates the timestamp to publish the video' do
|
348
348
|
expect(video.update attrs).to be true
|
349
|
-
expect(video.scheduled_at).to eq new_scheduled_at
|
350
349
|
expect(video.privacy_status).to eq old_privacy_status
|
351
350
|
expect(video.title).to eq old_title
|
351
|
+
# NOTE: This is another irrational behavior of YouTube API. In short,
|
352
|
+
# the response of Video#update *does not* include the publishAt value
|
353
|
+
# even if it exists. You need to call Video#list again to get it.
|
354
|
+
video = Yt::Video.new id: id, auth: $account
|
355
|
+
expect(video.scheduled_at).to eq new_scheduled_at
|
356
|
+
# Setting a private (scheduled) video to private has no effect:
|
357
|
+
expect(video.update privacy_status: 'private').to be true
|
358
|
+
video = Yt::Video.new id: id, auth: $account
|
359
|
+
expect(video.scheduled_at).to eq new_scheduled_at
|
360
|
+
# Setting a private (scheduled) video to unlisted/public removes publishAt:
|
361
|
+
expect(video.update privacy_status: 'unlisted').to be true
|
362
|
+
video = Yt::Video.new id: id, auth: $account
|
363
|
+
expect(video.scheduled_at).to be_nil
|
352
364
|
end
|
353
365
|
end
|
354
366
|
|
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.25.
|
4
|
+
version: 0.25.12
|
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-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
312
|
version: '0'
|
313
313
|
requirements: []
|
314
314
|
rubyforge_project:
|
315
|
-
rubygems_version: 2.
|
315
|
+
rubygems_version: 2.5.0
|
316
316
|
signing_key:
|
317
317
|
specification_version: 4
|
318
318
|
summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,
|