yt 0.32.0 → 0.32.1

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: f06db796f31fee245ad83b3d20908c1e652d61fb
4
- data.tar.gz: d1d811649caf2f5c4ef4dc689d71b97ef2290c5d
3
+ metadata.gz: 9b8170d3a7debea512ed16ea94625623a4189a93
4
+ data.tar.gz: eaa9f9146b89cb1bf686176299433c57d8ca0c64
5
5
  SHA512:
6
- metadata.gz: 76902d316c6b13754da0501c52740faf226784e9f47ee002ad0552a1571a61f604caad50bad5b9c560abcbc6a0b863ad234b2b9e56620acf6cdba2aeca723a1a
7
- data.tar.gz: 3a91d3dbbe592a8b189c301d2a122fb522a32dcb012b82ed5d6c9e3f306be283969b7c6bff01eaf34bb4605e2997fece355245f669cc8d117b89a021f8a16696
6
+ metadata.gz: 0a7892632cc6eb1660a675736690ea4efa55f77af26dcbd9e1c9a657662925b352b714a0da14ab95fa842908b89ecca7b01b48adcccbe277ec5e79473b2f3698
7
+ data.tar.gz: 811a28e571213a03359b3b1fbeb2c8d0498a664196238594c91e0f0de4ae5000d524356c631d3f84e36a76e0c226117f0026bd4123bdfbee3dc9a1bdbe617111
@@ -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]
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.32.0'
2
+ VERSION = '0.32.1'
3
3
  end
@@ -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.0
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-07-05 00:00:00.000000000 Z
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