yt 0.28.2 → 0.28.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -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 +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cad6d554a08d0f66ce4f01416cc074aeca4fff70
|
4
|
+
data.tar.gz: d152421eb245bd35bb1da08bf458dabf6bf24cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e46db76032a6712cab5ca375582011ab3fc9911c3c63429aa3720e5b95d4952a8ec5da24019deaadeb9bf5bcbba238b92f674c5908ca77a86c24513435ba6664
|
7
|
+
data.tar.gz: 852f235f55b5484478bd878482fac903136aadb53a6064fc1a4d332778c8e732489be2f24f89aaa14f26718bd6d3a92279ba24cb0c8228dd144d2fb8eb02f72a
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ 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.28.3 - 2017-01-09
|
10
|
+
|
11
|
+
* [FEATURE] Add `VideoGroup#channels` method to load all channels under a group.
|
12
|
+
|
9
13
|
## 0.28.2 - 2017-01-09
|
10
14
|
|
11
15
|
* [FEATURE] Add `channel_url` to video.
|
@@ -160,6 +160,26 @@ module Yt
|
|
160
160
|
Collections::Videos.new(auth: @auth).where(conditions).map(&:itself)
|
161
161
|
end
|
162
162
|
end
|
163
|
+
|
164
|
+
def all_channel_ids
|
165
|
+
resource_ids = group_items.map {|item| item.data['resource']['id']}.uniq
|
166
|
+
case group_info.data['itemType']
|
167
|
+
when "youtube#video"
|
168
|
+
resource_ids.flat_map do |video_id|
|
169
|
+
Yt::Video.new(id: video_id, auth: @auth).channel_id
|
170
|
+
end.uniq
|
171
|
+
when "youtube#channel"
|
172
|
+
resource_ids
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def channels
|
177
|
+
all_channel_ids.each_slice(50).flat_map do |channel_ids|
|
178
|
+
conditions = {id: channel_ids.join(',')}
|
179
|
+
conditions[:part] = 'snippet'
|
180
|
+
Collections::Channels.new(auth: @auth).where(conditions).map(&:itself)
|
181
|
+
end
|
182
|
+
end
|
163
183
|
end
|
164
184
|
end
|
165
185
|
end
|
data/lib/yt/version.rb
CHANGED
@@ -15,6 +15,11 @@ describe Yt::VideoGroup, :partner do
|
|
15
15
|
expect(video.instance_variable_defined? :@status).to be true
|
16
16
|
expect(video.instance_variable_defined? :@statistics_set).to be true
|
17
17
|
end
|
18
|
+
|
19
|
+
specify '.channels loads each channel' do
|
20
|
+
channel = video_group.channels.first
|
21
|
+
expect(channel.instance_variable_defined? :@snippet).to be true
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
|
@@ -51,6 +56,11 @@ describe Yt::VideoGroup, :partner do
|
|
51
56
|
expect(video.instance_variable_defined? :@statistics_set).to be true
|
52
57
|
end
|
53
58
|
|
59
|
+
specify '.channels loads each channel' do
|
60
|
+
channel = video_group.channels.first
|
61
|
+
expect(channel.instance_variable_defined? :@snippet).to be true
|
62
|
+
end
|
63
|
+
|
54
64
|
describe 'multiple reports can be retrieved at once' do
|
55
65
|
metrics = {views: Integer, uniques: Integer,
|
56
66
|
estimated_minutes_watched: Integer, comments: Integer, likes: Integer,
|