yt 0.13.3 → 0.13.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
  SHA1:
3
- metadata.gz: c4b21a647e6bab1583b5afb67fef9459ecf59466
4
- data.tar.gz: fb879355564a7238927f8ad32aa3201bbe4631b8
3
+ metadata.gz: e9d9ab320576b3abe7d5fe25d1587aeafa866de8
4
+ data.tar.gz: fb397821560706f3ea9317121ce73672aec5380c
5
5
  SHA512:
6
- metadata.gz: c453c1f45ae6eadb041cad24806891575fd4fdf9b3972a237442f4522b4b134a9c36521fa70724ee65ef332d81f44357b94f4e54eba43c9a6ff80c2908a617cc
7
- data.tar.gz: de773e6562299849e7d901f5926578000175faf1fa1e66ec9bd4561e5531441e5eacd09527e644bce9cbd9d647dfa894a34557cd1ac3c05652d29bf8ab3c3360
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
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gem 'pry'
2
+
3
3
  # Specify your gem's dependencies in yt.gemspec
4
4
  gemspec
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.3'
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
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.13.3'
2
+ VERSION = '0.13.4'
3
3
  end
@@ -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(:params) { {asset_id: asset_id, video_id: video_id, policy_id: policy_id, content_type: 'audiovisual'} }
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
- specify 'can be added' do
20
- begin
21
- expect($content_owner.create_claim params).to be_a Yt::Claim
22
- rescue Yt::Errors::RequestError => e
23
- # @note: Every time this test runs, a claim is inserted for the same
24
- # video and asset, but YouTube does not allow this, and responds with
25
- # an error message like "Video is already claimed. Existing claims
26
- # on this video: AbCdEFg1234".
27
- # For the sake of testing, we delete the duplicate and try again.
28
- raise unless e.reasons.include? 'alreadyClaimed'
29
- id = e.kind['message'].match(/this video: (.*?)$/) {|re| re[1]}
30
- Yt::Claim.new(id: id, auth: $content_owner).delete
31
- expect($content_owner.create_claim params).to be_a Yt::Claim
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo