yt 0.25.36 → 0.25.37
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/CHANGELOG.md +3 -0
- data/lib/yt/models/video_group.rb +20 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/video_group_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15a20e76bf7d966fea857e957e7128323463f18a
|
|
4
|
+
data.tar.gz: e586722756127d69a2f1ff48887012b4c8df0355
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1113ca6fdc0dd8dab6a42e42d5b3a24fb39a6dcb2dcc407ce49e9864a8f63e6dd0988d402dbb4aa312148284c96d8dbf828f4f784d3076fa6ffacbb65397bf0
|
|
7
|
+
data.tar.gz: ff08ea36fd74728c6c98e113f3d20c89b1284b95faf36a75c3867aeb0a7a1d172cbc78f0626ff327c8cdce2bdbf735ba6210b7f251a6a82145992be13e24e9ac
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,9 @@ 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.25.37 - 2016-05-16
|
|
10
|
+
|
|
11
|
+
* [FEATURE] Add `VideoGroup#videos` to load all videos under a group of channels, as well as a group of videos.
|
|
9
12
|
|
|
10
13
|
## 0.25.36 - 2016-05-10
|
|
11
14
|
|
|
@@ -128,6 +128,26 @@ module Yt
|
|
|
128
128
|
params[:filters] = "group==#{id}"
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
|
+
|
|
132
|
+
def all_video_ids
|
|
133
|
+
resource_ids = group_items.map{|item| item.data['resource']['id']}.uniq
|
|
134
|
+
case group_info.data["itemType"]
|
|
135
|
+
when "youtube#video"
|
|
136
|
+
resource_ids
|
|
137
|
+
when "youtube#channel"
|
|
138
|
+
resource_ids.flat_map do |channel_id|
|
|
139
|
+
Yt::Channel.new(id: channel_id, auth: @auth).videos.map(&:id)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def videos
|
|
145
|
+
all_video_ids.each_slice(50).flat_map do |video_ids|
|
|
146
|
+
conditions = {id: video_ids.join(',')}
|
|
147
|
+
conditions[:part] = 'snippet,status,statistics,contentDetails'
|
|
148
|
+
Collections::Videos.new(auth: @auth).where(conditions).map(&:itself)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
131
151
|
end
|
|
132
152
|
end
|
|
133
153
|
end
|
data/lib/yt/version.rb
CHANGED
|
@@ -5,6 +5,19 @@ require 'yt/models/group_item'
|
|
|
5
5
|
describe Yt::VideoGroup, :partner do
|
|
6
6
|
subject(:video_group) { Yt::VideoGroup.new id: id, auth: $content_owner }
|
|
7
7
|
|
|
8
|
+
context 'given a channel-group', :partner do
|
|
9
|
+
context 'managed by the authenticated Content Owner' do
|
|
10
|
+
let(:id) { ENV['YT_TEST_PARTNER_CHANNEL_GROUP_ID'] }
|
|
11
|
+
|
|
12
|
+
specify '.videos loads each video of each channel' do
|
|
13
|
+
video = video_group.videos.first
|
|
14
|
+
expect(video.instance_variable_defined? :@snippet).to be true
|
|
15
|
+
expect(video.instance_variable_defined? :@status).to be true
|
|
16
|
+
expect(video.instance_variable_defined? :@statistics_set).to be true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
8
21
|
context 'given a video-group', :partner do
|
|
9
22
|
context 'managed by the authenticated Content Owner' do
|
|
10
23
|
let(:id) { ENV['YT_TEST_PARTNER_VIDEO_GROUP_ID'] }
|
|
@@ -31,6 +44,13 @@ describe Yt::VideoGroup, :partner do
|
|
|
31
44
|
expect(item.video.instance_variable_defined? :@statistics_set).to be true
|
|
32
45
|
end
|
|
33
46
|
|
|
47
|
+
specify '.videos loads each video' do
|
|
48
|
+
video = video_group.videos.first
|
|
49
|
+
expect(video.instance_variable_defined? :@snippet).to be true
|
|
50
|
+
expect(video.instance_variable_defined? :@status).to be true
|
|
51
|
+
expect(video.instance_variable_defined? :@statistics_set).to be true
|
|
52
|
+
end
|
|
53
|
+
|
|
34
54
|
describe 'multiple reports can be retrieved at once' do
|
|
35
55
|
metrics = {views: Integer, uniques: Integer,
|
|
36
56
|
estimated_minutes_watched: Integer, comments: Integer, likes: Integer,
|
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.25.
|
|
4
|
+
version: 0.25.37
|
|
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-05-
|
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|