yt 0.11.2 → 0.11.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 623d648b88a71c977785d91777067b7fe749b9ec
4
- data.tar.gz: 41516787a905b8c36b1ce390c6850bffefed8a53
3
+ metadata.gz: f14047bf293cc77254c5b1568b77772d9162679f
4
+ data.tar.gz: 3ceaca9cb7e02268d70c8f74764d94cf699a64a4
5
5
  SHA512:
6
- metadata.gz: c75aa4a2de0bbfae680c25edaff8ec2be11aa5e946577a1a55d94dce55a0690f67fb1ad57f794e979a22cf8170dcb664375a8fcd6890b223fe7ad70bb4f8413f
7
- data.tar.gz: eb62845c855fae0565a52755b53cbebbae108c7c952d7162943de3901fbe84195756076d4b7c9de1f5be5befdb75e65ac8d2409ac537f5fba7954b8cc6ffa7c3
6
+ metadata.gz: 6e4180dc908977fda2d25ed4f5915db585ac4986d4a1027ec8187297d8c3107813ed724362531805252beee2bdffa76307b5a3261c4974a7719762642887063a
7
+ data.tar.gz: 5c7963ef875961822546326461a58f3d77efce3cef08886bccaae8d53597134bc8eee6bc3751ee0d733f16ebd93c38d5c23b6415e72166063ed213d3f5b81f8d
@@ -5,32 +5,5 @@ matrix:
5
5
  include:
6
6
  - rvm: 1.9.3
7
7
  gemfile: gemfiles/Gemfile.activesupport-3.x
8
- env:
9
- - secure: OsmWyhhYNILEb1lhqxPX+iEfbWzC3dELuxQ7JGP9iN/FhqBtlV51cu+u2cBBdql6Gzuqi4VlMEeJSX0PQUmzOsMb0vHhOJDyp4a32NE+xry8LOT8XdCwni20ZBcUeFxC5hMUVebPuhqBTFjBWbXQKwKSXIdPnNWz31d9kyGIsxk=
10
8
  - rvm: 2.0.0
11
- gemfile: gemfiles/Gemfile.activesupport-4.x
12
- env:
13
- - secure: FrmFA2BE0FYyuKsf0FEO0EAXY+h048HbD1p3lu5XPo9/lxpAl7wM5m12HsnJQuNY6UlUmZ5bp9f8upCBZpz7cLZK5e/FWLWSvkv3Fts+NVsbAcVtFgvBKOCgTznZi/qgUtqbWBevkM3gyXyylzdB+c4wWjoOO/xSDVR227m8nMA=
14
- env:
15
- global:
16
- - secure: MKvaid8oW+io0vtzTUL6jNDBrgoxBe9RLEiFh/gKyVw8cj6bvRPBmYXrZfsNGZfns1i75/GaLCLNMl60ZJkfaN4twdPsh2ju6OnsrKW684G7Ha8Jv6GuaEYEwURBAGULW9EHylW5BlYE7H8SNRjtT8RLyIdjpFphuuiOuUO0/tE=
17
- - secure: K3f1RUzLByFOH44M50U02+hDNxFXNts6jWTI6PIP6DAn+j1QyQdvlm55kQ1/otf8L/ypH6GqxF/OQhEOK2xr72MVgFBh0wn4iF7U93Q6xX1ZBNwIGJ6lFWaJ6AP3M0y/Y4Qj3xVQpE6Ofq9TflqeGbuIplQv81z8FV+euq6l+XI=
18
- - secure: HyjaCM/coZiZJuIhIBSI+/1Uprs4NvcWAPcCAKtLClZtKLuqNQtKP+pF6aYabOQNFNFyLvcaooygx1VEESx0Hxb6V7OloJlrdt87xc0DxswNBxsZUUJifDW42HXLu5Mkq37fUvNAOKalRpn2mp0y87qJJGyYzo6KKDEvO9fH6HI=
19
- - secure: TIhkYLhm8jWq5syGQXknXq1UmBGqQr9BbQwr97ZMAZDHh9GR4WZ27r8R4h+P6a98NfUcl8B72c2TgNpV8Ix8IpAUPrysVmhnSu7LSskevRiEYUsKRKGRK3kgSzawjrxosclEOn4RbWcO/BUjN/2kvT1WZUyRgI8/eZ0WcMjvsP0=
20
- - secure: cY0QRvVWriQDvCN1+ntGme1YJfR+LlfXlaXOd7kGSw+JHXUMK49FAcdYXrN+lDA0lY8K2nBvHLvk62oWGvGbYmvqzXrNjljsHQWqtbiuI7AlGjcGDAqyrRcWRQhu+MppLTfduxGrgx+wqZZ9i+3bLiHod8HLa2tyO8P09A7groc=
21
- - secure: OeAZwuU8lwaU6h5UgUZ1qyPit6SlnqGifeR3C7+qV7JEFczaz4AckwgEaVcmIptQDO/QTa+kfyJVFkCA8tlPZffUarT7dVEyEfahTTFQTW0oOMXAxrY50MwAQ2ENWMXcoklClug5KiHvaaVtNMMA7HGGASMxBGyzgpniKRc4oN8=
22
- - secure: Z3dEcgRE4iC1LAnP2/mvcCygXwRWL4WglhWJEZrj84R+893Be2apXT/HpG5XRGrQ2LRXHfyXbA86TgIeZPTI/TRuopRAipesUjbshyjfO7hsGB0IY44trsn9ZFzJmtMArWiNljQBu+JArIkHLcIyXeoFoXxXw8Q7DHK/r1X6zjQ=
23
- - secure: Xqgy14pqYdYqXCzJMS5fFG7U0ihb7EofNAeY/CcsX6zR/ji8kSokbs3mT04amOhmh/nDYqd9dxgLhpqIs7GYOfK8rhyhq44byroM/zbA7+ZgB/bmul1DIEJxNc02CYiZIWMlz43DcnJHYpZe6uZvrU9m3KPkeaQOHXk4MUleUXc=
24
- - secure: Cc4GzjWnegDjcta/m74sZ+k/8s1UHHp8yMGn5PfPJLlQcNl/X1IfPtgGTObqhZipJuZAlrl6zfjzaOY2zjqlpd06zW0ed8YCO7n4QsYGy9/S/GNaItvRIAvfRuB0QIOeTTKnp6SsvklT0izCSHmiGK3jukTmFcNY3f4OmLSZfzk=
25
- - secure: PsvtNvJjqT46wQ9vwC0vcYruFORR31KU4CYoUjW7cOgQRcUgdLF8Te7hVOsLr1xQtMiVJwOgrcIznAFNkAau6RICpMlqvG68GKddpk6mCbxuI3RlWmHxdlRjUwEVxUyV57tLS6KWaIj6koa4S2RF8RAbUX+3yiI+iLLACm0vu68=
26
- - secure: RBDqdSnd8Y3uMmtbqdPpJ96TEP12dqmoJu3ecBhOgnTMsQ/Gsfx+rD2s5MMZdErY+8mmGduMH8NCnw3RIWtBWu7tYAelFjqDzhvZo1de0uJzmCw/zA+KqNceP5s4FwVvwmFj7mr7SKyNMJ0FZjwqR4tcXhX28c3Zi6Fq2hULmQQ=
27
- - secure: V3cOMG0aPefKiuKAlrfZb6cMJLMAv8A538qf0Ouw1MN6ngL6uqDaQqissp+/sGp4wUfTJdjVtQn/j4IA1gmk9vdRydILhOryL4X0w2uV1Ip33PEawi+EOOZO2W1vxNrLQO4LvOZmz376sifXwPN3d0aethnHhZ4DiuJrZRT/BUA=
28
- - secure: CFmPvFamKLdyaTEAHbtNAOStc4nIjbHcF2g2fyH/s4kxBWCwUlUdEN9/K7Fa9SX6orf/PUA4R08t6o3NLyt/S1dC9DKezZmfTYKuhRNzTOHCiSjeIoDpgdY/lglnTHvr7kuT9ceGAgWk/hmEw7/wQ6ASK4g6G+zRaYi4KDlcM94=
29
- - secure: DjWReu3fGGGlk0B2k3sfM5HwRkxNqKo9QNaXYAZa8mJuZs990U7LjfvFEPKHaYTsxPCv1ANEiBGHQYjmlFnKh6B+FmAz5JCtrxRbSARzQ9DBjxyWGNIK064fcFHqYb309OYH8NhCc8WYxr/gn7FJjDb5NCoCIGQ2sYrk4pSormM=
30
- - secure: BCr8OowszYHLieino4Zr/E/I8rJujRFFmsY12WovoQiILIbEBonBoTHV1duVcCZyh4MFsdH8rH7NFNCYpeNuETwcU5DPbr3hsALS/4FzBe4J1WixI7jN1wyVWPtSbwfSje8rGMjQmwlML1dgm1QtmI/5MD6mpybwHFrQB9RSV/k=
31
- - secure: FwxY5FMyWDyNkHbiZf3odst2kC5iIb00n0lRFU97Ywj8jioqjzKr/x4JCXjKbqFUz4a32mM72fBoj3hqhKnL6/cdnTdhigt3yegR3ozzidcu2SFeZTEDqsHGN0hhqjQIzMI6oKHyqWafSeYtgE18FtxsNpeefZWnRWcQytIMxAI=
32
- - secure: CFkNT5WI2ATF3TKehTSuCwzG4EENnoVXaddL0PqpuH4Ss82k0k0xcJBhKbmD3Qkf7nw8y0g4s3jCepHssB2ZwzqQinKcYvamzIbsNPuhsuvlc9rMvT9ZosT5CHsiRJANl+OeZ8l2SqGu6kCMDx45h+fL7YZEtn3jjVZYEAXQSig=
33
- - secure: WWuYLNKcTM+fjgFrRT4qa3y4IlwO6xeSkM16jbDG05FUIThMfWRVQHhs5JThw/M3SByWGWySmz74sNpGV6V/yt9jw8o1u6F81j0ec2oeHDCwkZ8xK8ubPv3Pmg14PGr1Awu04zfhTEY9KzJt6HrFSYzek/MpV5Prg4J1l6SgqyU=
34
- - secure: YuWrOwaqBT0tLVe90OkfCLX/7tzrLhsOBn7LnqH0Ifw6T+EddNDmQLriWLRny8uNQSg7j/AhPOuEvR/ImOibK3a003LyxQZUx9KrEOkgIa5c82OlOLdcvmXw/8wnQ/SEdTDs8r2l1aZ2NxiieCA3fl7oxR1Lt/O+lS/vgqQY+uM=
35
- - secure: VlE28fpY6cy6a9HYq+cdGmSXM54bZkbGzqSAqvgxTIJubMzSPSvQ7p5zdLtWPG9yQqYUOXyhKItZE/Eno0VemHDyV9qj0mo0JKb2c4OmX3aupIYTh38LZodkGmW+NGxa8GaebqYeDJeH33ZLtl9aumahzgUtGykKOkNIPH6Igy4=
36
- - secure: YcjKPgsmOFbAeJrxl/d7idji/TX9/EZLXuO3ZYy3NLljy0GXdXtFBiAaE7DDTEG4PNLp+EJTpc/XbEu8yL1ozeH3lpGPeRU+Mk2LTFI2GAjpz6DeOucEx+sFEJJHr+eqsavQrNMzgOBii3TTmMP66Dp/T1L0HlcWT3v680jfS6A=
9
+ gemfile: gemfiles/Gemfile.activesupport-4.x
@@ -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.11.3 - 2014-08-21
10
+
11
+ * [FEATURE] Add `update` method to Asset model
12
+
9
13
  ## 0.11.2 - 2014-08-20
10
14
 
11
15
  * [FEATURE] Add AdvertisingOptionsSet with `update` to change the advertising settings of a video
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.11.2'
44
+ gem 'yt', '~> 0.11.3'
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*)
@@ -208,7 +208,7 @@ channel.impressions_on 5.days.ago #=> 157.0
208
208
  channel.viewer_percentages #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
209
209
  channel.viewer_percentage(gender: :female) #=> 49.12
210
210
 
211
- channel.content_owner #=> 'FullScreen'
211
+ channel.content_owner #=> 'CMSname'
212
212
  channel.linked_at #=> Wed, 28 May 2014
213
213
  ```
214
214
 
@@ -456,6 +456,7 @@ Use [Yt::MatchPolicy](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/
456
456
  content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
457
457
  match_policy = Yt::MatchPolicy.new asset_id: 'ABCD12345678', auth: content_owner
458
458
  match_policy.update policy_id: 'aBcdEF6g-HJ' #=> true
459
+ ```
459
460
 
460
461
  Yt::Asset
461
462
  ---------
@@ -463,14 +464,18 @@ Yt::Asset
463
464
  Use [Yt::Asset](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/Asset) to:
464
465
 
465
466
  * read the ownership of an asset
467
+ * update the attributes of an asset
466
468
 
467
469
  ```ruby
468
470
 
469
471
  content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
470
472
  asset = Yt::Asset.new id: 'ABCD12345678', auth: content_owner
471
473
  asset.ownership #=> #<Yt::Models::Ownership @general=...>
472
- asset.general_owners.first.owner #=> 'FullScreen'
474
+ asset.ownership.obtain! #=> true
475
+ asset.general_owners.first.owner #=> 'CMSname'
473
476
  asset.general_owners.first.everywhere? #=> true
477
+
478
+ asset.update metadata_mine: {notes: 'Some notes'} #=> true
474
479
  ```
475
480
 
476
481
  *The methods above require to be authenticated as the video’s content owner (see below).*
@@ -485,7 +490,7 @@ Use [Yt::Ownership](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/Ow
485
490
  ```ruby
486
491
  content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
487
492
  ownership = Yt::Ownership.new asset_id: 'ABCD12345678', auth: $content_owner
488
- new_general_owner_attrs = {ratio: 100, owner: 'FullScreen', type: 'include', territories: ['US', 'CA']}
493
+ new_general_owner_attrs = {ratio: 100, owner: 'CMSname', type: 'include', territories: ['US', 'CA']}
489
494
  ownership.update general: [new_general_owner_attrs]
490
495
  ```
491
496
 
@@ -13,6 +13,12 @@ module Yt
13
13
  @auth = options[:auth]
14
14
  end
15
15
 
16
+ def update(attributes = {})
17
+ underscore_keys! attributes
18
+ do_patch body: attributes
19
+ true
20
+ end
21
+
16
22
  # @!attribute [r] ownership
17
23
  # @return [Yt::Models::Ownership] the asset’s ownership.
18
24
  has_one :ownership
@@ -30,7 +36,7 @@ module Yt
30
36
  # @return [Boolean] whether the asset is inactive.
31
37
  # def delete
32
38
  # body = {id: id, status: :inactive}
33
- # do_update(body: body) {|data| @data = data}
39
+ # do_patch(body: body) {|data| @data = data}
34
40
  # inactive?
35
41
  # end
36
42
 
@@ -83,18 +89,15 @@ module Yt
83
89
 
84
90
  private
85
91
 
86
- # @see https://developers.google.com/youtube/partner/docs/v1/assets/update
87
- # @note Despite what the documentation says, YouTube API never returns
88
- # the status of an asset, so it’s impossible to update, although the
89
- # documentation says this should be the case. If YouTube ever fixes
90
- # the API, then the following code can be uncommented.
91
- # def update_params
92
- # super.tap do |params|
93
- # params[:expected_response] = Net::HTTPOK
94
- # params[:path] = "/youtube/partner/v1/assets/#{id}"
95
- # params[:params] = {on_behalf_of_content_owner: @auth.owner_name}
96
- # end
97
- # end
92
+ # @see https://developers.google.com/youtube/partner/docs/v1/assets/patch
93
+ def patch_params
94
+ super.tap do |params|
95
+ params[:expected_response] = Net::HTTPOK
96
+ params[:path] = "/youtube/partner/v1/assets/#{@id}"
97
+ params[:params] = {on_behalf_of_content_owner: @auth.owner_name}
98
+ end
99
+ end
100
+
98
101
  end
99
102
  end
100
103
  end
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.11.2'
2
+ VERSION = '0.11.3'
3
3
  end
@@ -6,7 +6,15 @@ describe Yt::Asset, :partner do
6
6
  let(:asset) { Yt::Asset.new id: asset_id, auth: $content_owner }
7
7
  describe 'given an asset administered by the content owner' do
8
8
  let(:asset_id) { ENV['YT_TEST_PARTNER_ASSET_ID'] }
9
- it { expect(asset.ownership).to be_a Yt::Ownership }
9
+
10
+ specify 'the ownership can be obtained' do
11
+ expect(asset.ownership).to be_a Yt::Ownership
12
+ end
13
+
14
+ describe 'the asset can be updated' do
15
+ let(:attrs) { {metadata_mine: {notes: 'Yt notes'}} }
16
+ it { expect(asset.update attrs).to be true }
17
+ end
10
18
  end
11
19
  end
12
20
  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.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport