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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d88cc558d8e85a8068b7391fbdb8d128cb47348b
4
- data.tar.gz: 3ce716f091f380d73a9886a50867e731f23944b8
3
+ metadata.gz: cad6d554a08d0f66ce4f01416cc074aeca4fff70
4
+ data.tar.gz: d152421eb245bd35bb1da08bf458dabf6bf24cea
5
5
  SHA512:
6
- metadata.gz: db3bcc9e841de83bf0f761aecf71ad2f5d17d685d807e0ce12dc06d0b970ff00ffc040ad4912b289ce535c8d5bfdace7f17f7ca5a65553c0f5576c30eec48826
7
- data.tar.gz: f27e12130e07f2d437020692638b4c1036d208da75cc8e3c378081c2d07412b8e5747c400b07ee1681f018e9ba26a4edc7839cd81d7f5fca00eee930b634aab0
6
+ metadata.gz: e46db76032a6712cab5ca375582011ab3fc9911c3c63429aa3720e5b95d4952a8ec5da24019deaadeb9bf5bcbba238b92f674c5908ca77a86c24513435ba6664
7
+ data.tar.gz: 852f235f55b5484478bd878482fac903136aadb53a6064fc1a4d332778c8e732489be2f24f89aaa14f26718bd6d3a92279ba24cb0c8228dd144d2fb8eb02f72a
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.28.2'
2
+ VERSION = '0.28.3'
3
3
  end
@@ -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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.28.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo