yt 0.32.0 → 0.32.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +31 -0
- data/lib/yt/collections/bulk_report_jobs.rb +28 -0
- data/lib/yt/collections/bulk_reports.rb +24 -0
- data/lib/yt/models/bulk_report.rb +23 -0
- data/lib/yt/models/bulk_report_job.rb +23 -0
- data/lib/yt/models/content_owner.rb +5 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/bulk_report_job_spec.rb +19 -0
- data/spec/requests/as_content_owner/content_owner_spec.rb +10 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b8170d3a7debea512ed16ea94625623a4189a93
|
4
|
+
data.tar.gz: eaa9f9146b89cb1bf686176299433c57d8ca0c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a7892632cc6eb1660a675736690ea4efa55f77af26dcbd9e1c9a657662925b352b714a0da14ab95fa842908b89ecca7b01b48adcccbe277ec5e79473b2f3698
|
7
|
+
data.tar.gz: 811a28e571213a03359b3b1fbeb2c8d0498a664196238594c91e0f0de4ae5000d524356c631d3f84e36a76e0c226117f0026bd4123bdfbee3dc9a1bdbe617111
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ 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.32.1 - 2017-08-14
|
10
|
+
|
11
|
+
* [FEATURE] Add `Yt::ContentOwner#bulk_report_jobs`
|
12
|
+
* [FEATURE] Add `Yt::BulkReportJob#bulk_reports`
|
13
|
+
|
9
14
|
## 0.32.0 - 2017-07-05
|
10
15
|
|
11
16
|
**How to upgrade**
|
data/README.md
CHANGED
@@ -166,6 +166,37 @@ comment.updated_at #=> 2016-03-22 12:56:56 UTC
|
|
166
166
|
comment.parent_id #=> "abc1234" (return nil if the comment is not a reply)
|
167
167
|
```
|
168
168
|
|
169
|
+
Yt::BulkReportJob
|
170
|
+
----------------
|
171
|
+
|
172
|
+
Use [Yt::BulkReportJob](http://www.rubydoc.info/gems/yt/Yt/Models/BulkReportJob) to:
|
173
|
+
|
174
|
+
* Get details of a bulk report job.
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
|
178
|
+
bulk_report_job = content_owner.bulk_report_jobs.first
|
179
|
+
|
180
|
+
bulk_report_job.report_type_id #=> "content_owner_demographics_a1"
|
181
|
+
```
|
182
|
+
|
183
|
+
Yt::BulkReport
|
184
|
+
----------------
|
185
|
+
|
186
|
+
Use [Yt::BulkReport](http://www.rubydoc.info/gems/yt/Yt/Models/BulkReport) to:
|
187
|
+
|
188
|
+
* Get details of a bulk report.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
|
192
|
+
bulk_report_job = content_owner.bulk_report_jobs.first
|
193
|
+
bulk_report = bulk_report_job.bulk_reports.first
|
194
|
+
|
195
|
+
bulk_report.start_time #=> 2017-08-11 07:00:00 UTC
|
196
|
+
bulk_report.end_time #=> 2017-08-12 07:00:00 UTC
|
197
|
+
bulk_report.download_url #=> "https://youtubereporting.googleapis.com/v1/..."
|
198
|
+
```
|
199
|
+
|
169
200
|
Yt::Collections::Videos
|
170
201
|
-----------------------
|
171
202
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'yt/collections/base'
|
2
|
+
require 'yt/models/bulk_report_job'
|
3
|
+
|
4
|
+
module Yt
|
5
|
+
module Collections
|
6
|
+
# @private
|
7
|
+
class BulkReportJobs < Base
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def attributes_for_new_item(data)
|
12
|
+
{id: data['id'], auth: @auth, report_type_id: data['reportTypeId']}
|
13
|
+
end
|
14
|
+
|
15
|
+
def list_params
|
16
|
+
super.tap do |params|
|
17
|
+
params[:host] = 'youtubereporting.googleapis.com'
|
18
|
+
params[:path] = "/v1/jobs"
|
19
|
+
params[:params] = {on_behalf_of_content_owner: @parent.owner_name}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def items_key
|
24
|
+
'jobs'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'yt/collections/base'
|
2
|
+
require 'yt/models/bulk_report'
|
3
|
+
|
4
|
+
module Yt
|
5
|
+
module Collections
|
6
|
+
# @private
|
7
|
+
class BulkReports < Base
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def list_params
|
12
|
+
super.tap do |params|
|
13
|
+
params[:host] = 'youtubereporting.googleapis.com'
|
14
|
+
params[:path] = "/v1/jobs/#{@parent.id}/reports"
|
15
|
+
params[:params] = {on_behalf_of_content_owner: @parent.auth.owner_name}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def items_key
|
20
|
+
'reports'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'yt/models/base'
|
2
|
+
|
3
|
+
module Yt
|
4
|
+
module Models
|
5
|
+
# Provides methods to interact with YouTube Analytics bulk reports.
|
6
|
+
# @see https://developers.google.com/youtube/reporting/v1/reference/rest/v1/jobs.reports
|
7
|
+
class BulkReport < Base
|
8
|
+
# @private
|
9
|
+
attr_reader :auth
|
10
|
+
|
11
|
+
has_attribute :id
|
12
|
+
has_attribute :start_time, type: Time
|
13
|
+
has_attribute :end_time, type: Time
|
14
|
+
has_attribute :download_url
|
15
|
+
|
16
|
+
# @private
|
17
|
+
def initialize(options = {})
|
18
|
+
@data = options.fetch(:data, {})
|
19
|
+
@auth = options[:auth]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'yt/models/base'
|
2
|
+
|
3
|
+
module Yt
|
4
|
+
module Models
|
5
|
+
# Provides methods to interact with YouTube Analytics bulk report jobs.
|
6
|
+
# @see https://developers.google.com/youtube/reporting/v1/reference/rest/v1/jobs
|
7
|
+
class BulkReportJob < Base
|
8
|
+
# @private
|
9
|
+
attr_reader :id, :auth, :report_type_id
|
10
|
+
|
11
|
+
# @private
|
12
|
+
def initialize(options = {})
|
13
|
+
@id = options[:id]
|
14
|
+
@auth = options[:auth]
|
15
|
+
@report_type_id = options[:report_type_id]
|
16
|
+
end
|
17
|
+
|
18
|
+
# @!attribute [r] bulk_reports
|
19
|
+
# @return [Yt::Collections::BulkReports] the bulk reports of this job.
|
20
|
+
has_many :bulk_reports
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -35,6 +35,11 @@ module Yt
|
|
35
35
|
# content owner.
|
36
36
|
has_many :video_groups
|
37
37
|
|
38
|
+
# @!attribute [r] bulk_report_jobs
|
39
|
+
# @return [Yt::Collections::BulkReportJobs] the bulk reporting jobs managed by the
|
40
|
+
# content owner.
|
41
|
+
has_many :bulk_report_jobs
|
42
|
+
|
38
43
|
def initialize(options = {})
|
39
44
|
super options
|
40
45
|
@owner_name = options[:owner_name]
|
data/lib/yt/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yt/models/bulk_report_job'
|
3
|
+
|
4
|
+
describe Yt::BulkReportJob, :partner do
|
5
|
+
|
6
|
+
describe '.bulk_reports' do
|
7
|
+
describe 'given the bulk report job has bulk reports' do
|
8
|
+
let(:job) { $content_owner.bulk_report_jobs.first }
|
9
|
+
let(:report) { job.bulk_reports.first }
|
10
|
+
|
11
|
+
it 'returns valid bulk reports' do
|
12
|
+
expect(report.id).to be_a String
|
13
|
+
expect(report.start_time).to be_a Time
|
14
|
+
expect(report.end_time).to be_a Time
|
15
|
+
expect(report.download_url).to be_a String
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -305,6 +305,16 @@ describe Yt::ContentOwner, :partner do
|
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
308
|
+
describe '.bulk_report_jobs' do
|
309
|
+
describe 'given the content owner has bulk report jobs' do
|
310
|
+
let(:job) { $content_owner.bulk_report_jobs.first }
|
311
|
+
|
312
|
+
it 'returns valid job' do
|
313
|
+
expect(job.id).to be_a String
|
314
|
+
expect(job.report_type_id).to be_a String
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
308
318
|
# @note: The following test works, but YouTube API endpoint to mark
|
309
319
|
# an asset as 'invalid' (soft-delete) does not work, and apparently
|
310
320
|
# there is no way to update the status of a asset.
|
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.32.
|
4
|
+
version: 0.32.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -148,6 +148,8 @@ files:
|
|
148
148
|
- lib/yt/collections/assets.rb
|
149
149
|
- lib/yt/collections/authentications.rb
|
150
150
|
- lib/yt/collections/base.rb
|
151
|
+
- lib/yt/collections/bulk_report_jobs.rb
|
152
|
+
- lib/yt/collections/bulk_reports.rb
|
151
153
|
- lib/yt/collections/channels.rb
|
152
154
|
- lib/yt/collections/claim_histories.rb
|
153
155
|
- lib/yt/collections/claims.rb
|
@@ -198,6 +200,8 @@ files:
|
|
198
200
|
- lib/yt/models/asset_snippet.rb
|
199
201
|
- lib/yt/models/authentication.rb
|
200
202
|
- lib/yt/models/base.rb
|
203
|
+
- lib/yt/models/bulk_report.rb
|
204
|
+
- lib/yt/models/bulk_report_job.rb
|
201
205
|
- lib/yt/models/channel.rb
|
202
206
|
- lib/yt/models/claim.rb
|
203
207
|
- lib/yt/models/claim_event.rb
|
@@ -296,6 +300,7 @@ files:
|
|
296
300
|
- spec/requests/as_content_owner/account_spec.rb
|
297
301
|
- spec/requests/as_content_owner/advertising_options_set_spec.rb
|
298
302
|
- spec/requests/as_content_owner/asset_spec.rb
|
303
|
+
- spec/requests/as_content_owner/bulk_report_job_spec.rb
|
299
304
|
- spec/requests/as_content_owner/channel_spec.rb
|
300
305
|
- spec/requests/as_content_owner/claim_history_spec.rb
|
301
306
|
- spec/requests/as_content_owner/content_owner_spec.rb
|
@@ -401,6 +406,7 @@ test_files:
|
|
401
406
|
- spec/requests/as_content_owner/account_spec.rb
|
402
407
|
- spec/requests/as_content_owner/advertising_options_set_spec.rb
|
403
408
|
- spec/requests/as_content_owner/asset_spec.rb
|
409
|
+
- spec/requests/as_content_owner/bulk_report_job_spec.rb
|
404
410
|
- spec/requests/as_content_owner/channel_spec.rb
|
405
411
|
- spec/requests/as_content_owner/claim_history_spec.rb
|
406
412
|
- spec/requests/as_content_owner/content_owner_spec.rb
|