yt 0.26.2 → 0.26.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: 8b401e7fc1527689e8d57bba9adfb082bb1edad7
4
- data.tar.gz: 05c8c0777af55da0d355ab056716ce471645db2d
3
+ metadata.gz: 9c8bd5aecd37bbb0c4209b5fa1b0c7b425610629
4
+ data.tar.gz: 008187e83de0b7e3da55e65b12ff42ccb3f1dd40
5
5
  SHA512:
6
- metadata.gz: 1473ef3a2b7731419bd69879e944a8f997cdbda15c06180bf998b18b555f2d4561d30667df24f41078597ef3405897fd614c8489bf8330597cc34a2002d5c2b3
7
- data.tar.gz: 8d822e0aec52874704030eea47e7fb23f21338df2792096167c27304c3b148ecf01ab0e9803faa2f783aea88bc3bb2b637d7fac7be24366b89c1555038d80bc4
6
+ metadata.gz: 558f54d0e5e96a1d8bdec7bd737c7fbd5b3706a675c04baf36176b100735f95633e6412a3fa1f445b2f0c7c713832dfc309a07a2cf112fccd0b0d94c84a9dc42
7
+ data.tar.gz: 45cd8bb547e80018da19faabfd2a89adfbcce1035382c1192d1cead129ab583f778e8e82a7c028b261db0c25d8091a270d4a4863e225719a5242c3717ccde812
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.26.3 - 2016-10-07
10
+
11
+ * [FEATURE] Add `by: :subscribed_status` option for reports, to return views (from a `content_owner.video`) by subscribed status.
12
+ * [FEATURE] Add `Yt::Collections::Reports::SUBSCRIBED_STATUSES` to list all subscribed statuses supported by YouTube Analytics API.
13
+
9
14
  ## 0.26.2 - 2016-10-05
10
15
 
11
16
  * [ENHANCEMENT] Add newly available traffic sources: "Campaign card" and "End screen"
@@ -11,6 +11,7 @@ module Yt
11
11
  hash[:traffic_source] = {name: 'insightTrafficSourceType', parse: ->(source, *values) { @metrics.keys.zip(values.map{|v| {TRAFFIC_SOURCES.key(source) => v}}).to_h} }
12
12
  hash[:playback_location] = {name: 'insightPlaybackLocationType', parse: ->(location, *values) { @metrics.keys.zip(values.map{|v| {PLAYBACK_LOCATIONS.key(location) => v}}).to_h} }
13
13
  hash[:embedded_player_location] = {name: 'insightPlaybackLocationDetail', parse: ->(url, *values) {@metrics.keys.zip(values.map{|v| {url => v}}).to_h} }
14
+ hash[:subscribed_status] = {name: 'subscribedStatus', parse: ->(status, *values) {@metrics.keys.zip(values.map{|v| {SUBSCRIBED_STATUSES.key(status) => v}}).to_h} }
14
15
  hash[:related_video] = {name: 'insightTrafficSourceDetail', parse: ->(video_id, *values) { @metrics.keys.zip(values.map{|v| {video_id => v}}).to_h} }
15
16
  hash[:search_term] = {name: 'insightTrafficSourceDetail', parse: ->(search_term, *values) {@metrics.keys.zip(values.map{|v| {search_term => v}}).to_h} }
16
17
  hash[:referrer] = {name: 'insightTrafficSourceDetail', parse: ->(url, *values) {@metrics.keys.zip(values.map{|v| {url => v}}).to_h} }
@@ -61,6 +62,12 @@ module Yt
61
62
  mobile: 'MOBILE' # only present for data < September 10, 2013
62
63
  }
63
64
 
65
+ # @see https://developers.google.com/youtube/analytics/v1/dimsmets/dims#Playback_Detail_Dimensions
66
+ SUBSCRIBED_STATUSES = {
67
+ subscribed: 'SUBSCRIBED',
68
+ unsubscribed: 'UNSUBSCRIBED'
69
+ }
70
+
64
71
  # @see https://developers.google.com/youtube/analytics/v1/dimsmets/dims#Device_Dimensions
65
72
  DEVICE_TYPES = {
66
73
  desktop: 'DESKTOP',
@@ -126,7 +133,7 @@ module Yt
126
133
  end
127
134
  elsif dimension == :day
128
135
  hash = hash.transform_values{|h| h.sort_by{|day, v| day}.to_h}
129
- elsif dimension.in? [:traffic_source, :country, :state, :playback_location, :device_type, :operating_system]
136
+ elsif dimension.in? [:traffic_source, :country, :state, :playback_location, :device_type, :operating_system, :subscribed_status]
130
137
  hash = hash.transform_values{|h| h.sort_by{|range, v| -v}.to_h}
131
138
  end
132
139
  (@metrics.one? || @metrics.keys == [:earnings, :estimated_minutes_watched]) ? hash[@metrics.keys.first] : hash
data/lib/yt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.26.2'
2
+ VERSION = '0.26.3'
3
3
  end
@@ -422,6 +422,17 @@ describe Yt::Video, :partner do
422
422
  end
423
423
  end
424
424
 
425
+ describe 'views can be grouped by subscribed statuses' do
426
+ let(:range) { {since: ENV['YT_TEST_PARTNER_VIDEO_DATE']} }
427
+ let(:keys) { Yt::Collections::Reports::SUBSCRIBED_STATUSES.keys }
428
+
429
+ specify 'with the :by option set to subscribed statuses' do
430
+ views = video.views range.merge by: :subscribed_status
431
+ expect(views.keys - keys).to be_empty
432
+ expect(views.values).to all(be_an Integer)
433
+ end
434
+ end
435
+
425
436
  describe 'uniques can be retrieved for a single US state' do
426
437
  let(:state_code) { 'NY' }
427
438
  let(:result) { video.uniques since: date, by: by, in: location }
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.26.2
4
+ version: 0.26.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: 2016-10-06 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport