yt 0.8.2 → 0.8.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 +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +1 -0
- data/README.md +11 -2
- data/lib/yt/associations/has_authentication.rb +1 -0
- data/lib/yt/collections/content_owners.rb +32 -0
- data/lib/yt/models/account.rb +5 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/account_spec.rb +25 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd5d7adb4f5c9a5cce9d5aa7988594c447bdbbaf
|
4
|
+
data.tar.gz: 920b28b819d0d154ef3e5668378ffdfdac0fb53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0bbbe167612926e3d0f6be004d54fc97bedc57f315089e27864a421bd839ae908f8af714a1d393e6c69a4a02a8124958f808a41eb94fe9f2850a079875a1e33
|
7
|
+
data.tar.gz: fc5be7fdfff6dd49919aba6e18dfdb3893ba81bd9382429949dda92c8a81219bb48b2b6d0ab3547029bbcb048d58220e30004bf5f2622ba25da3dad37c83ab18
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -5,6 +5,7 @@ v0.8 - 2014/07/18
|
|
5
5
|
* Add all the status fields to Video (upload status, failure reason, rejection reason, scheduled time, license, embeddable, public stats viewable)
|
6
6
|
* Add content_owner.claims to list the claims administered by a content owner.
|
7
7
|
* Allow content_owner.claims to be chained with .where, such as in account.videos.where(q: 'query')
|
8
|
+
* Add account.content_owners to list content owners associated with an account
|
8
9
|
|
9
10
|
v0.7 - 2014/06/18
|
10
11
|
-----------------
|
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.8.
|
44
|
+
gem 'yt', '~> 0.8.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*)
|
@@ -76,7 +76,16 @@ account.upload_video 'my_video.mp4', title: 'My new video', privacy_status: 'pri
|
|
76
76
|
account.upload_video 'http://example.com/remote.m4v', title: 'My other video', tags: ['music']
|
77
77
|
```
|
78
78
|
|
79
|
-
*
|
79
|
+
*The methods above require to be authenticated as a YouTube account (see below).*
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
|
83
|
+
|
84
|
+
account.content_owners.count #=> 3
|
85
|
+
account.content_owners.first #=> #<Yt::Models::ContentOwner @id=...>
|
86
|
+
```
|
87
|
+
|
88
|
+
*The methods above require to be authenticated as a YouTube Content Partner account (see below).*
|
80
89
|
|
81
90
|
Yt::ContentOwner
|
82
91
|
----------------
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'yt/collections/base'
|
2
|
+
require 'yt/models/content_owner'
|
3
|
+
|
4
|
+
module Yt
|
5
|
+
module Collections
|
6
|
+
# Provides methods to interact with a collection of Content Owners.
|
7
|
+
#
|
8
|
+
# Resources with content_owners are: {Yt::Models::Account accounts}.
|
9
|
+
class ContentOwners < Base
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def new_item(data)
|
14
|
+
Yt::ContentOwner.new owner_name: data['id'], authentication: @auth.authentication
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Hash] the parameters to submit to YouTube to list content
|
18
|
+
# owners administered by the account.
|
19
|
+
# @see https://developers.google.com/youtube/partner/docs/v1/contentOwners/list
|
20
|
+
def list_params
|
21
|
+
super.tap do |params|
|
22
|
+
params[:params] = content_owners_params
|
23
|
+
params[:path] = '/youtube/partner/v1/contentOwners'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def content_owners_params
|
28
|
+
{fetchMine: true}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/yt/models/account.rb
CHANGED
@@ -32,6 +32,11 @@ module Yt
|
|
32
32
|
# upload videos using the resumable upload protocol.
|
33
33
|
has_many :resumable_sessions
|
34
34
|
|
35
|
+
# @!attribute [r] content_owners
|
36
|
+
# @return [Yt::Collections::ContentOwners] the content_owners accessible
|
37
|
+
# by the account.
|
38
|
+
has_many :content_owners
|
39
|
+
|
35
40
|
# Uploads a video
|
36
41
|
# @param [String] path_or_url the video to upload. Can either be the
|
37
42
|
# path of a local file or the URL of a remote file.
|
data/lib/yt/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'yt/models/account'
|
4
|
+
|
5
|
+
describe Yt::Account, :partner do
|
6
|
+
subject(:account) { Yt::Account.new id: id, authentication: $content_owner.authentication }
|
7
|
+
|
8
|
+
describe '.content_owners' do
|
9
|
+
let(:content_owners) { account.content_owners }
|
10
|
+
|
11
|
+
context 'given a partenered account with content owners', :partner do
|
12
|
+
let(:id) { $content_owner.id }
|
13
|
+
|
14
|
+
specify 'returns the associated content owners' do
|
15
|
+
expect(content_owners.size).to be > 0
|
16
|
+
expect(content_owners.first).to be_a Yt::ContentOwner
|
17
|
+
end
|
18
|
+
|
19
|
+
specify 'ensures the content owners have the same credentials as the account' do
|
20
|
+
expect(content_owners.first.access_token).to eq account.access_token
|
21
|
+
expect(content_owners.first.refresh_token).to eq account.refresh_token
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.8.
|
4
|
+
version: 0.8.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-07-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/yt/collections/channels.rb
|
135
135
|
- lib/yt/collections/claims.rb
|
136
136
|
- lib/yt/collections/content_details.rb
|
137
|
+
- lib/yt/collections/content_owners.rb
|
137
138
|
- lib/yt/collections/device_flows.rb
|
138
139
|
- lib/yt/collections/ids.rb
|
139
140
|
- lib/yt/collections/partnered_channels.rb
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- spec/requests/as_account/resource_spec.rb
|
225
226
|
- spec/requests/as_account/video.mp4
|
226
227
|
- spec/requests/as_account/video_spec.rb
|
228
|
+
- spec/requests/as_content_owner/account_spec.rb
|
227
229
|
- spec/requests/as_content_owner/channel_spec.rb
|
228
230
|
- spec/requests/as_content_owner/content_owner_spec.rb
|
229
231
|
- spec/requests/as_content_owner/video_spec.rb
|
@@ -304,6 +306,7 @@ test_files:
|
|
304
306
|
- spec/requests/as_account/resource_spec.rb
|
305
307
|
- spec/requests/as_account/video.mp4
|
306
308
|
- spec/requests/as_account/video_spec.rb
|
309
|
+
- spec/requests/as_content_owner/account_spec.rb
|
307
310
|
- spec/requests/as_content_owner/channel_spec.rb
|
308
311
|
- spec/requests/as_content_owner/content_owner_spec.rb
|
309
312
|
- spec/requests/as_content_owner/video_spec.rb
|