yt 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/yt/collections/claims.rb +1 -1
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/content_owner_spec.rb +39 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d9ab320576b3abe7d5fe25d1587aeafa866de8
|
4
|
+
data.tar.gz: fb397821560706f3ea9317121ce73672aec5380c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8181eed2373c5ba17fb6becd92b1b79c65f557ab774b41fcd0fd4465695da09f647323411d929d91a40919fa218107e14082623252d24bb5ca888c275de9de6
|
7
|
+
data.tar.gz: 16cfc4e112c3bc7ec144501408ac831b5a5165591ecf9467d2de48091be47203c7487dcecb578875b1301276055f356b540930774a11f476fe2df13a08692b67
|
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.13.4 - 2014-10-01
|
10
|
+
|
11
|
+
* [ENHANCEMENT] Accept `policy` (with custom set of rules) in `content_owner.create_claim`
|
12
|
+
|
9
13
|
## 0.13.3 - 2014-10-01
|
10
14
|
|
11
15
|
* [BUGFIX] Rescue OpenSSL::SSL::SSLErrorWaitReadable raised by YouTube servers.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -41,7 +41,7 @@ To install on your system, run
|
|
41
41
|
|
42
42
|
To use inside a bundled Ruby project, add this line to the Gemfile:
|
43
43
|
|
44
|
-
gem 'yt', '~> 0.13.
|
44
|
+
gem 'yt', '~> 0.13.4'
|
45
45
|
|
46
46
|
Since the gem follows [Semantic Versioning](http://semver.org),
|
47
47
|
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
@@ -9,7 +9,7 @@ module Yt
|
|
9
9
|
class Claims < Base
|
10
10
|
def insert(attributes = {})
|
11
11
|
underscore_keys! attributes
|
12
|
-
body = attributes.slice :asset_id, :video_id, :content_type
|
12
|
+
body = attributes.slice :asset_id, :video_id, :content_type, :policy
|
13
13
|
body[:policy] = {id: attributes[:policy_id]} if attributes[:policy_id]
|
14
14
|
params = {on_behalf_of_content_owner: @auth.owner_name}
|
15
15
|
do_insert(params: params, body: body)
|
data/lib/yt/version.rb
CHANGED
@@ -12,23 +12,47 @@ describe Yt::ContentOwner, :partner do
|
|
12
12
|
|
13
13
|
describe 'claims' do
|
14
14
|
let(:asset_id) { ENV['YT_TEST_PARTNER_ASSET_ID'] }
|
15
|
-
let(:policy_id) { ENV['YT_TEST_PARTNER_POLICY_ID'] }
|
16
15
|
let(:video_id) { ENV['YT_TEST_PARTNER_CLAIMABLE_VIDEO_ID'] }
|
17
|
-
let(:
|
16
|
+
let(:options) { {asset_id: asset_id, video_id: video_id, content_type: 'audiovisual'} }
|
17
|
+
|
18
|
+
context 'given an existing policy ID' do
|
19
|
+
let(:policy_id) { ENV['YT_TEST_PARTNER_POLICY_ID'] }
|
20
|
+
let(:params) { options.merge policy_id: policy_id }
|
21
|
+
|
22
|
+
specify 'can be added' do
|
23
|
+
begin
|
24
|
+
expect($content_owner.create_claim params).to be_a Yt::Claim
|
25
|
+
rescue Yt::Errors::RequestError => e
|
26
|
+
# @note: Every time this test runs, a claim is inserted for the same
|
27
|
+
# video and asset, but YouTube does not allow this, and responds with
|
28
|
+
# an error message like "Video is already claimed. Existing claims
|
29
|
+
# on this video: AbCdEFg1234".
|
30
|
+
# For the sake of testing, we delete the duplicate and try again.
|
31
|
+
raise unless e.reasons.include? 'alreadyClaimed'
|
32
|
+
id = e.kind['message'].match(/this video: (.*?)$/) {|re| re[1]}
|
33
|
+
Yt::Claim.new(id: id, auth: $content_owner).delete
|
34
|
+
expect($content_owner.create_claim params).to be_a Yt::Claim
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
18
38
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
39
|
+
context 'given a new policy' do
|
40
|
+
let(:params) { options.merge policy: {rules: [action: :block]} }
|
41
|
+
|
42
|
+
specify 'can be added' do
|
43
|
+
begin
|
44
|
+
expect($content_owner.create_claim params).to be_a Yt::Claim
|
45
|
+
rescue Yt::Errors::RequestError => e
|
46
|
+
# @note: Every time this test runs, a claim is inserted for the same
|
47
|
+
# video and asset, but YouTube does not allow this, and responds with
|
48
|
+
# an error message like "Video is already claimed. Existing claims
|
49
|
+
# on this video: AbCdEFg1234".
|
50
|
+
# For the sake of testing, we delete the duplicate and try again.
|
51
|
+
raise unless e.reasons.include? 'alreadyClaimed'
|
52
|
+
id = e.kind['message'].match(/this video: (.*?)$/) {|re| re[1]}
|
53
|
+
Yt::Claim.new(id: id, auth: $content_owner).delete
|
54
|
+
expect($content_owner.create_claim params).to be_a Yt::Claim
|
55
|
+
end
|
32
56
|
end
|
33
57
|
end
|
34
58
|
end
|