yt 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +8 -461
  5. data/lib/yt/actions/base.rb +1 -0
  6. data/lib/yt/associations/has_attribute.rb +2 -0
  7. data/lib/yt/associations/has_authentication.rb +2 -0
  8. data/lib/yt/associations/has_many.rb +1 -0
  9. data/lib/yt/associations/has_one.rb +1 -0
  10. data/lib/yt/associations/has_reports.rb +24 -18
  11. data/lib/yt/collections/authentications.rb +1 -0
  12. data/lib/yt/collections/content_details.rb +1 -0
  13. data/lib/yt/collections/content_owner_details.rb +1 -0
  14. data/lib/yt/collections/file_details.rb +1 -0
  15. data/lib/yt/collections/ids.rb +1 -0
  16. data/lib/yt/collections/live_streaming_details.rb +1 -0
  17. data/lib/yt/collections/players.rb +1 -0
  18. data/lib/yt/collections/ratings.rb +1 -0
  19. data/lib/yt/collections/reports.rb +25 -16
  20. data/lib/yt/collections/resources.rb +1 -0
  21. data/lib/yt/collections/resumable_sessions.rb +1 -0
  22. data/lib/yt/collections/snippets.rb +1 -0
  23. data/lib/yt/collections/statistics_sets.rb +1 -0
  24. data/lib/yt/collections/statuses.rb +1 -0
  25. data/lib/yt/collections/subscriptions.rb +1 -0
  26. data/lib/yt/collections/user_infos.rb +1 -0
  27. data/lib/yt/models/account.rb +28 -26
  28. data/lib/yt/models/base.rb +1 -0
  29. data/lib/yt/models/channel.rb +38 -38
  30. data/lib/yt/models/content_detail.rb +1 -0
  31. data/lib/yt/models/content_owner_detail.rb +1 -0
  32. data/lib/yt/models/device_flow.rb +1 -0
  33. data/lib/yt/models/file_detail.rb +1 -0
  34. data/lib/yt/models/iterator.rb +1 -0
  35. data/lib/yt/models/live_streaming_detail.rb +1 -0
  36. data/lib/yt/models/player.rb +1 -0
  37. data/lib/yt/models/playlist.rb +19 -19
  38. data/lib/yt/models/playlist_item.rb +12 -12
  39. data/lib/yt/models/rating.rb +1 -0
  40. data/lib/yt/models/resource.rb +8 -2
  41. data/lib/yt/models/resumable_session.rb +1 -0
  42. data/lib/yt/models/snippet.rb +1 -0
  43. data/lib/yt/models/statistics_set.rb +1 -0
  44. data/lib/yt/models/status.rb +1 -6
  45. data/lib/yt/models/subscription.rb +1 -0
  46. data/lib/yt/models/timestamp.rb +1 -0
  47. data/lib/yt/models/url.rb +1 -0
  48. data/lib/yt/models/user_info.rb +1 -0
  49. data/lib/yt/models/video.rb +70 -70
  50. data/lib/yt/models/video_category.rb +1 -0
  51. data/lib/yt/request.rb +1 -0
  52. data/lib/yt/version.rb +1 -1
  53. data/spec/collections/reports_spec.rb +1 -1
  54. data/spec/requests/as_content_owner/channel_spec.rb +210 -14
  55. data/spec/requests/as_content_owner/playlist_spec.rb +68 -8
  56. data/spec/requests/as_content_owner/video_spec.rb +213 -16
  57. data/spec/requests/as_server_app/channel_spec.rb +27 -7
  58. data/spec/requests/as_server_app/playlist_spec.rb +25 -4
  59. data/spec/requests/as_server_app/video_spec.rb +26 -5
  60. metadata +1 -3
  61. data/spec/requests/as_server_app/resource_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a257c84e731d03c889aba6d840ae8945bff703c3
4
- data.tar.gz: acddd55c13ed4013e4e8acae7c303e864bbd114b
3
+ metadata.gz: e6287e851c03a8285e094efa577c17f0a9ca6204
4
+ data.tar.gz: 0da6d402a9062dc8cc9e1759636d691f505eae13
5
5
  SHA512:
6
- metadata.gz: 0c82294cbdb20eebf4208eacf95c370afa8044121bf20e8b76514979a3a4d981d2e4a46fdf82cb2915f701c983aeba9802d03405203adee27726b24a83d76a86
7
- data.tar.gz: 469b86367d016835333f6a16c06a7f5463246eb4d5c53155d12e5f8274947ec85115cd891db6cda289f138075f3b05b0b156ba384e31e4d1f62207204bbf4741
6
+ metadata.gz: f345bff512092cf0ff25bb9223fccbe1555fba58a71bf5711312b870322925a1335c929a88e84d3c2317cd69883fcb50b80d89a102b3b64ffc96475f6064185a
7
+ data.tar.gz: 9544b7238eca631c1f933a9789ff88480fb57025126048c7e1bc07a5d0427ec191d5bfb3e0064c41c8c7c22a14287012a0acb0e1621cafff10d67bece4d3aa2d
data/.yardopts CHANGED
@@ -1,3 +1,4 @@
1
+ --non-transitive-tag private
1
2
  --no-private
2
3
  lib/yt/associations/has_reports.rb
3
4
  lib/yt/associations/has_viewer_percentages.rb
data/CHANGELOG.md CHANGED
@@ -6,6 +6,19 @@ 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.22.0 - 2015-04-30
10
+
11
+ **How to upgrade**
12
+
13
+ If your code expects any of the following method to return Float values, then
14
+ be aware that they now return Integer. You can still call `to_f` if you do need
15
+ a Float: views, `comments`, `likes`, `dislikes`, `shares`, `subscribers_gained`,
16
+ `subscribers_lost`, `favorites_added`, `favorites_removed`, `annotations`,
17
+ `impressions`, `monetized_plybacks`, `playlist_starts`.
18
+
19
+ * [ENHANCEMENT] Return `Integer` values for reports that can never return decimal digits.
20
+ * [FEATURE] New `by: :range` option for reports, to return a metric without dimensions (that is, for the whole range)
21
+
9
22
  ## 0.21.0 - 2015-04-30
10
23
 
11
24
  **How to upgrade**
data/README.md CHANGED
@@ -41,7 +41,7 @@ To install on your system, run
41
41
 
42
42
  To use inside a bundled Ruby project, add this line to the Gemfile:
43
43
 
44
- gem 'yt', '~> 0.21.0'
44
+ gem 'yt', '~> 0.22.0'
45
45
 
46
46
  Since the gem follows [Semantic Versioning](http://semver.org),
47
47
  indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
@@ -54,47 +54,8 @@ Available resources
54
54
  Yt::Account
55
55
  -----------
56
56
 
57
- Use [Yt::Account](http://www.rubydoc.info/gems/yt/Yt/Models/Account) to:
57
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/accounts.html) for the list of methods available for `Yt::Account`.
58
58
 
59
- * authenticate as a YouTube account
60
- * read the attributes of the account
61
- * access the channel managed by the account
62
- * access the videos uploaded by the account
63
- * create playlist
64
- * upload a video
65
- * list the channels subscribed to an account
66
-
67
- ```ruby
68
- # Accounts can be initialized with access token, refresh token or an authorization code
69
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
70
-
71
- account.email #=> .. your e-mail address..
72
- account.channel #=> #<Yt::Models::Channel @id=...>
73
-
74
- account.videos.count #=> 12
75
- account.videos.first #=> #<Yt::Models::Video @id=...>
76
-
77
- account.upload_video 'my_video.mp4', title: 'My new video', privacy_status: 'private', category_id: '17'
78
- account.upload_video 'http://example.com/remote.m4v', title: 'My other video', tags: ['music']
79
-
80
- account.create_playlist title: 'New playlist', privacy_status: 'unlisted' #=> true
81
-
82
- account.subscribers.count #=> 2
83
- account.subscribers.first #=> #<Yt::Models::Channel @id=...>
84
- account.subscribers.first.title #=> 'Fullscreen'
85
-
86
- ```
87
-
88
- *The methods above require to be authenticated as a YouTube account (see below).*
89
-
90
- ```ruby
91
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
92
-
93
- account.content_owners.count #=> 3
94
- account.content_owners.first #=> #<Yt::Models::ContentOwner @id=...>
95
- ```
96
-
97
- *The methods above require to be authenticated as a YouTube Content Partner account (see below).*
98
59
 
99
60
  Yt::ContentOwner
100
61
  ----------------
@@ -138,424 +99,22 @@ content_owner.create_asset type: 'web' #=> #<Yt::Models::Asset @id=...>
138
99
  Yt::Channel
139
100
  -----------
140
101
 
141
- Use [Yt::Channel](http://www.rubydoc.info/gems/yt/Yt/Models/Channel) to:
142
-
143
- * read the attributes of a channel
144
- * access the videos of a channel
145
- * access the playlists of a channel
146
- * access the channels that the channel is subscribed to
147
- * subscribe to and unsubscribe from a channel
148
- * delete playlists from a channel
149
- * retrieve the daily earnings, views, comments, likes, dislikes, shares, subscribers gained/lost, annotation clicks, annotation click-through rate, annotation close rate, estimated/average video watch and impressions of a channel by day
150
- * retrieve the views and estimated minutes watched by traffic source
151
- * retrieve the views and estimated minutes watched by playback location
152
- * retrieve the views and estimated minutes watched by embedded player location
153
- * retrieve the views and estimated minutes watched by related video
154
- * retrieve the views and estimated minutes watched by video
155
- * retrieve the views and estimated minutes watched by playlist
156
- * retrieve the views and estimated minutes watched by device type
157
- * retrieve the viewer percentage of a channel by gender, by age group or by both
158
-
159
- ```ruby
160
- # Channels can be initialized with ID or URL
161
- channel = Yt::Channel.new url: 'youtube.com/fullscreen'
162
-
163
- channel.title #=> "Fullscreen"
164
- channel.description #=> "The first media company for the connected generation."
165
- channel.description.has_link_to_playlist? #=> false
166
- channel.thumbnail_url #=> "https://yt3.ggpht.com/-KMnbKDBl60w/.../photo.jpg"
167
- channel.published_at #=> 2006-03-23 06:13:25 UTC
168
- channel.public? #=> true
169
-
170
- channel.view_count #=> 421619
171
- channel.comment_count #=> 773
172
- channel.video_count #=> 12
173
- channel.subscriber_count #=> 136925
174
- channel.subscriber_count_visible? #=> true
175
-
176
- channel.videos.count #=> 12
177
- channel.videos.first #=> #<Yt::Models::Video @id=...>
178
-
179
- channel.playlists.count #=> 2
180
- channel.playlists.first #=> #<Yt::Models::Playlist @id=...>
181
-
182
- channel.subscribed_channels.count #=> 132
183
- channel.subscribed_channels.first #=> #<Yt::Models::Channel @id=...>
184
- ```
185
-
186
- *The methods above do not require authentication.*
187
-
188
- ```ruby
189
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
190
- channel = Yt::Channel.new id: 'UCxO1tY8h1AhOz0T4ENwmpow', auth: account
191
-
192
- channel.subscribed? #=> false
193
- channel.subscribe #=> true
194
- ```
195
-
196
- *The methods above require to be authenticated as a YouTube account (see below).*
197
-
198
- ```ruby
199
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
200
- channel = Yt::Channel.new id: 'UCxO1tY8h1AhOz0T4ENwmpow', auth: account
201
-
202
- channel.delete_playlists title: 'New playlist' #=> [true]
203
-
204
- channel.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
205
- channel.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014 => 4.0, …}
206
- channel.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
207
- channel.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
208
- channel.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
209
- channel.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
210
- channel.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
211
- channel.favorites_added from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
212
- channel.favorites_removed from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
213
- channel.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
214
- channel.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
215
- channel.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
216
- channel.annotation_clicks #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
217
- channel.annotation_click_through_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
218
- channel.annotation_close_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
219
- channel.viewer_percentage #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
220
-
221
- channel.views since: 7.days.ago, by: :traffic_source #=> {advertising: 10.0, related_video: 20.0, promoted: 5.0, subscriber: 1.0, channel: 3.0, other: 7.0}
222
- channel.estimated_minutes_watched since: 7.days.ago, by: :traffic_source #=> {annotation: 10.0, external_app: 20.0, external_url: 5.0, embedded: 1.0, search: 3.0}
223
-
224
- channel.views since: 7.days.ago, by: :playback_location #=> {embedded: 34.0, watch: 467.0, channel: 462.0, other: 3.0}
225
- channel.estimated_minutes_watched since: 7.days.ago, by: :playback_location #=> {embedded: 34.0, watch: 467.0, channel: 462.0, other: 3.0}
226
-
227
- channel.views since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
228
- channel.estimated_minutes_watched since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
229
-
230
- channel.views since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
231
- channel.estimated_minutes_watched since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
232
-
233
- channel.views since: 7.days.ago, by: :video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
234
- channel.estimated_minutes_watched since: 7.days.ago, by: :video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
235
-
236
- channel.views since: 7.days.ago, by: :playlist #=> {#<Yt::Models::Playlist @id=...>: 10.0, #<Yt::Models::Playlist @id=...>: 20.0, …}
237
- channel.estimated_minutes_watched since: 7.days.ago, by: :playlist #=> {#<Yt::Models::Playlist @id=...>: 10.0, #<Yt::Models::Playlist @id=...>: 20.0, …}
238
-
239
- channel.views since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
240
- channel.estimated_minutes_watched since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
241
- ```
242
-
243
- *The methods above require to be authenticated as the channel’s account (see below).*
244
-
245
- ```ruby
246
- content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
247
- channel = Yt::Channel.new id: 'UCxO1tY8h1AhOz0T4ENwmpow', auth: content_owner
248
-
249
- channel.earnings_on 5.days.ago #=> 12.23
250
- channel.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
251
- channel.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014 => 4.0, …}
252
- channel.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
253
- channel.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
254
- channel.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
255
- channel.impressions_on 5.days.ago #=> 157.0
256
- channel.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
257
- channel.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
258
- channel.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
259
- channel.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
260
- channel.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
261
- channel.annotation_clicks #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
262
- channel.annotation_click_through_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
263
- channel.annotation_close_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
264
- channel.viewer_percentage since: 7.days.ago #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
265
-
266
- channel.views since: 7.days.ago, by: :traffic_source #=> {advertising: 10.0, related_video: 20.0, promoted: 5.0, subscriber: 1.0, channel: 3.0, other: 7.0}
267
- channel.estimated_minutes_watched since: 7.days.ago, by: :traffic_source #=> {annotation: 10.0, external_app: 20.0, external_url: 5.0, embedded: 1.0, search: 3.0}
268
- channel.views since: 7.days.ago, by: :playback_location #=> {embedded: 34.0, watch: 467.0, channel: 462.0, other: 3.0}
269
- channel.estimated_minutes_watched since: 7.days.ago, by: :playback_location #=> {embedded: 34.0, watch: 467.0, channel: 462.0, other: 3.0}
270
- channel.views since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
271
- channel.estimated_minutes_watched since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
272
- channel.views since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
273
- channel.estimated_minutes_watched since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
274
- channel.views since: 7.days.ago, by: :video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
275
- channel.estimated_minutes_watched since: 7.days.ago, by: :video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
276
- channel.views since: 7.days.ago, by: :playlist #=> {#<Yt::Models::Playlist @id=...>: 10.0, #<Yt::Models::Playlist @id=...>: 20.0, …}
277
- channel.estimated_minutes_watched since: 7.days.ago, by: :playlist #=> {#<Yt::Models::Playlist @id=...>: 10.0, #<Yt::Models::Playlist @id=...>: 20.0, …}
278
- channel.views since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
279
- channel.estimated_minutes_watched since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
280
- channel.monetized_playbacks_on 5.days.ago #=> 123.0
281
- channel.viewer_percentage since: 7.days.ago, by: :gender #=> {female: 49.12, male: 50.88}
282
- channel.viewer_percentage since: 7.days.ago, by: :age_group #=> {'18-24' => 12.12, '25-34' => 16.16,…}
283
-
284
- channel.content_owner #=> 'CMSname'
285
- channel.linked_at #=> Wed, 28 May 2014
286
- ```
287
-
288
- *The methods above require to be authenticated as the channel’s content owner (see below).*
102
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/channels.html) for the list of methods available for `Yt::Channel`.
289
103
 
290
104
  Yt::Video
291
- -----------
292
-
293
- Use [Yt::Video](http://www.rubydoc.info/gems/yt/Yt/Models/Video) to:
294
-
295
- * read the attributes of a video
296
- * update the attributes of a video
297
- * upload a thumbnail for a video
298
- * access the annotations of a video
299
- * delete a video
300
- * like and dislike a video
301
- * retrieve the daily earnings, views, comments, likes, dislikes, shares, subscribers gained/lost, impressions, annotation clicks, annotation click-through rate, annotation close rate and monetized playbacks of a video by day
302
- * retrieve the views of a video by traffic source
303
- * retrieve the views of a video by playback location
304
- * retrieve the views of a video by embedded player location
305
- * retrieve the views of a video by related video
306
- * retrieve the views of a video by device type
307
- * retrieve the viewer percentage of a video by gender, by age group or by both
308
- * retrieve data about live-streaming videos
309
- * retrieve the advertising options of a video
310
- * retrieve the HTML code of the video player
311
- * retrieve the file details of a video
312
- * retrieve the category title of a video
313
-
314
- ```ruby
315
- # Videos can be initialized with ID or URL
316
- video = Yt::Video.new url: 'http://youtu.be/MESycYJytkU'
317
-
318
- video.title #=> "Fullscreen Creator Platform"
319
- video.description #=> "The new Fullscreen Creator Platform gives creators and brands a suite..."
320
- video.description.has_link_to_channel? #=> true
321
- video.thumbnail_url #=> "https://i1.ytimg.com/vi/MESycYJytkU/default.jpg"
322
- video.published_at #=> 2013-07-09 16:27:32 UTC
323
- video.tags #=> []
324
- video.channel_id #=> "UCxO1tY8h1AhOz0T4ENwmpow"
325
- video.channel_title #=> "Fullscreen"
326
- video.category_id #=> "22"
327
- video.live_broadcast_content #=> "none"
328
-
329
- video.public? #=> true
330
- video.uploading? #=> false
331
- video.rejected? #=> false
332
- video.failed? #=> true
333
- video.processed? #=> false
334
- video.deleted? #=> false
335
- video.uses_unsupported_codec? #=> true
336
- video.has_failed_conversion? #=> false
337
- video.empty? #=> false
338
- video.invalid? #=> false
339
- video.too_small? #=> false
340
- video.aborted? #=> false
341
- video.claimed? #=> false
342
- video.infringes_copyright? #=> false
343
- video.duplicate? #=> false
344
- video.inappropriate? #=> false
345
- video.too_long? #=> false
346
- video.violates_terms_of_use? #=> false
347
- video.infringes_trademark? #=> false
348
- video.belongs_to_closed_account? #=> false
349
- video.belongs_to_suspended_account? #=> false
350
- video.scheduled? #=> true
351
- video.scheduled_at #=> Tue, 27 May 2014 12:50:00
352
- video.licensed_as_creative_commons? #=> true
353
- video.licensed_as_standard_youtube? #=> false
354
- video.embeddable? #=> false
355
- video.has_public_stats_viewable? #=> false
356
-
357
- video.duration #=> 86
358
- video.hd? #=> true
359
- video.stereoscopic? #=> false
360
- video.captioned? #=> true
361
- video.licensed? #=> false
362
-
363
- video.actual_start_time #=> Tue, 27 May 2014 12:50:00
364
- video.actual_end_time #=> Tue, 27 May 2014 12:54:00
365
- video.scheduled_start_time #=> Tue, 27 May 2014 12:49:00
366
- video.scheduled_end_time #=> Tue, 27 May 2014 12:55:00
367
- video.concurrent_viewers #=> 0
368
-
369
- video.embed_html #=> "<iframe type='text/html' src='http://www.youtube.com/embed/BPNYv0vd78A' width='640' height='360' frameborder='0' allowfullscreen='true'/>"
370
-
371
- video.file_size #=> 8000000
372
- video.file_type #=> "video"
373
- video.container #=> "mov"
374
-
375
- video.category_title #=> "People & Blogs"
376
-
377
- video.annotations.count #=> 1
378
- video.annotations.first #=> #<Yt::Models::Annotation @id=...>
379
- ```
380
-
381
- *The methods above do not require authentication.*
382
-
383
- ```ruby
384
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
385
- video = Yt::Video.new id: 'MESycYJytkU', auth: account
386
-
387
- video.liked? #=> false
388
- video.like #=> true
389
- ```
390
-
391
- *The methods above require to be authenticated as a YouTube account (see below).*
392
-
393
- ```ruby
394
- account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
395
- video = Yt::Video.new id: 'MESycYJytkU', auth: account
396
-
397
- video.update title: 'A title', description: 'A description <with angle brackets>'
398
- video.update tags: ['a tag'], categoryId: '21', license: 'creativeCommon'
399
-
400
- video.upload_thumbnail 'my_thumbnail.jpg'
401
- video.upload_thumbnail 'http://example.com/remote.png'
402
-
403
- video.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
404
- video.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014 => 4.0, …}
405
- video.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
406
- video.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
407
- video.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
408
- video.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
409
- video.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
410
- video.favorites_added from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
411
- video.favorites_removed from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
412
- video.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
413
- video.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
414
- video.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
415
- video.annotation_clicks #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
416
- video.annotation_click_through_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
417
- video.annotation_close_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
418
- video.viewer_percentage #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
419
-
420
- video.views since: 7.days.ago, by: :traffic_source #=> {advertising: 10.0, related_video: 20.0, promoted: 5.0, subscriber: 1.0, channel: 3.0, other: 7.0}
421
- video.views since: 7.days.ago, by: :playback_location #=> {:embedded=>6.0, :watch=>11.0}
422
- video.views since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
423
- video.views since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
424
- video.views since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
425
- video.viewer_percentage since: 7.days.ago, by: :gender #=> {female: 49.12, male: 50.88}
426
- video.viewer_percentage since: 7.days.ago, by: :age_group #=> {'18-24' => 12.12, '25-34' => 16.16,…}
427
-
428
- video.delete #=> true
429
- ```
430
-
431
- *The methods above require to be authenticated as the video’s owner (see below).*
432
-
433
- ```ruby
434
- content_owner = Yt::ContentOwner.new owner_name: 'CMSname', access_token: 'ya29.1.ABCDEFGHIJ'
435
- video = Yt::Video.new id: 'MESycYJytkU', auth: content_owner
436
-
437
- video.earnings_on 5.days.ago #=> 12.23
438
- video.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
439
- video.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014 => 4.0, …}
440
- video.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
441
- video.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
442
- video.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
443
- video.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
444
- video.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
445
- video.favorites_added from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
446
- video.favorites_removed from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
447
- video.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
448
- video.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
449
- video.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
450
- video.impressions_on 5.days.ago #=> 157.0
451
- video.monetized_playbacks_on 5.days.ago #=> 123.0
452
- video.annotation_clicks #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
453
- video.annotation_click_through_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
454
- video.annotation_close_rate #=> {Sun, 22 Feb 2015=>0.02, Mon, 23 Feb 2015=>0.03, …}
455
- video.viewer_percentage #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
456
-
457
- video.views since: 7.days.ago, by: :traffic_source #=> {advertising: 10.0, related_video: 20.0, promoted: 5.0, subscriber: 1.0, channel: 3.0, other: 7.0}
458
- video.views since: 7.days.ago, by: :playback_location #=> {:embedded=>6.0, :watch=>11.0}
459
- video.views since: 7.days.ago, by: :embedded_player_location #=> {"fullscreen.net"=>45.0, "linkedin.com"=>5.0, "mashable.com"=>1.0, "unknown"=>1.0}
460
- video.views since: 7.days.ago, by: :related_video #=> {#<Yt::Models::Video @id=...>: 10.0, #<Yt::Models::Video @id=...>: 20.0, …}
461
- video.views since: 7.days.ago, by: :device_type #=> {mobile: 144473.0, unknown_platform: 840.0, game_console: 4940.0, desktop: 102889.0, tv: 4134.0, tablet: 50189.0}
462
- video.viewer_percentage since: 7.days.ago, by: :gender #=> {female: 49.12, male: 50.88}
463
- video.viewer_percentage since: 7.days.ago, by: :age_group #=> {'18-24' => 12.12, '25-34' => 16.16,…}
464
-
465
- video.ad_formats #=> ["standard_instream", "trueview_instream"]
466
- ```
105
+ ---------
467
106
 
468
- *The methods above require to be authenticated as the video’s content owner (see below).*
107
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/videos.html) for the list of methods available for `Yt::Video`.
469
108
 
470
109
  Yt::Playlist
471
110
  ------------
472
111
 
473
- Use [Yt::Playlist](http://www.rubydoc.info/gems/yt/Yt/Models/Playlist) to:
474
-
475
- * read the attributes of a playlist
476
- * update the attributes of a playlist
477
- * access the items of a playlist
478
- * add one or multiple videos to a playlist
479
- * delete items from a playlist
480
- * retrieve the views, playlist starts, average time in playlist and views per playlist start of a playlist by day
481
-
482
- ```ruby
483
- # Playlists can be initialized with ID or URL
484
- playlist = Yt::Playlist.new url: 'youtube.com/playlist?list=PLSWYkYzOrPMRCK6j0UgryI8E0NHhoVdRc'
485
-
486
- playlist.title #=> "Fullscreen Features"
487
- playlist.description #=> "You send us your best videos and we feature our favorite ones..."
488
- playlist.description.has_link_to_subscribe? #=> false
489
- playlist.thumbnail_url #=> "https://i1.ytimg.com/vi/36kL2alg7Jk/default.jpg"
490
- playlist.published_at #=> 2012-11-27 21:23:38 UTC
491
- playlist.public? #=> true
492
- playlist.tags #=> []
493
- playlist.channel_id #=> "UCxO1tY8h1AhOz0T4ENwmpow"
494
- playlist.channel_title #=> "Fullscreen"
495
-
496
- playlist.playlist_items.count #=> 1
497
- playlist.playlist_items.first #=> #<Yt::Models::PlaylistItem @id=...>
498
- ```
499
-
500
- *The methods above do not require authentication.*
501
-
502
- ```ruby
503
- playlist.update title: 'A <title> with angle brackets', description: 'desc', tags: ['new tag'], privacy_status: 'private'
504
- playlist.add_video 'MESycYJytkU', position: 2
505
- playlist.add_videos ['MESycYJytkU', 'MESycYJytkU']
506
- playlist.delete_playlist_items title: 'Fullscreen Creator Platform' #=> [true]
507
-
508
- playlist.views_on 5.days.ago #=> 12.0
509
- playlist.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
510
-
511
- playlist.playlist_starts_on 5.days.ago #=> 12.0
512
- playlist.playlist_starts since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
513
-
514
- playlist.average_time_in_playlist_on 5.days.ago #=> 12.0
515
- playlist.average_time_in_playlist since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
516
-
517
- playlist.views_per_playlist_start_on 5.days.ago #=> 12.0
518
- playlist.views_per_playlist_start since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
519
-
520
- ```
521
-
522
- *The methods above require to be authenticated as the playlist’s owner (see below).*
112
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/playlists.html) for the list of methods available for `Yt::Playlist`.
523
113
 
524
114
  Yt::PlaylistItem
525
115
  ----------------
526
116
 
527
- Use [Yt::PlaylistItem](http://www.rubydoc.info/gems/yt/Yt/Models/PlaylistItem) to:
528
-
529
- * read the attributes of a playlist item
530
- * update the position of an item inside a playlist
531
- * delete a playlist item
532
-
533
- ```ruby
534
- item = Yt::PlaylistItem.new id: 'PLjW_GNR5Ir0GWEP_oveGBNjTvKkYyZfsna1TZDCBP-Z8'
535
-
536
- item.title #=> "Titanium - David Guetta - Space Among Many Cover ft. Evan Chan and Glenna Roberts"
537
- item.description #=> "CLICK to tweet this video: [...]"
538
- item.description.has_link_to_channel? #=> true
539
- item.thumbnail_url #=> "https://i1.ytimg.com/vi/W4GhTprSsOY/default.jpg"
540
- item.published_at #=> 2012-12-22 19:38:02 UTC
541
- item.public? #=> true
542
- item.channel_id #=> "UCxO1tY8h1AhOz0T4ENwmpow"
543
- item.channel_title #=> "Fullscreen"
544
- item.playlist_id #=> "PLSWYkYzOrPMRCK6j0UgryI8E0NHhoVdRc"
545
- item.position #=> 0
546
- item.video_id #=> "W4GhTprSsOY"
547
- item.video #=> #<Yt::Models::Video @id=...>
548
- ```
549
-
550
- *The methods above do not require authentication.*
551
-
552
- ```ruby
553
- item.update position: 3 #=> true
554
- item.delete #=> true
555
- ```
556
-
557
- *The methods above require to be authenticated as the playlist’s owner (see below).*
558
-
117
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/playlist_items.html) for the list of methods available for `Yt::PlaylistItem`.
559
118
 
560
119
  Yt::Collections::Videos
561
120
  -----------------------
@@ -578,20 +137,8 @@ videos.where(id: 'MESycYJytkU,invalid').map(&:title) #=> ["Fullscreen Creator Pl
578
137
  Yt::Annotation
579
138
  --------------
580
139
 
581
- Use [Yt::Annotation](http://www.rubydoc.info/gems/yt/Yt/Models/Annotation) to:
582
-
583
- * read the attributes of an annotation
584
-
585
- ```ruby
586
- video = Yt::Video.new id: 'MESycYJytkU'
587
- annotation = video.annotations.first
588
-
589
- annotation.below? 70 #=> false
590
- annotation.has_link_to_subscribe? #=> false
591
- annotation.has_link_to_playlist? #=> true
592
- ```
140
+ Check [fullscreen.github.io/yt](http://fullscreen.github.io/yt/annotations.html) for the list of methods available for `Yt::Annotation`.
593
141
 
594
- *Annotations do not require authentication.*
595
142
 
596
143
  Yt::MatchPolicy
597
144
  ---------------
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  module Yt
3
+ # @private
3
4
  module Actions
4
5
  # Abstract module that contains methods common to every action
5
6
  module Base
@@ -1,7 +1,9 @@
1
1
  require 'yt/models/timestamp'
2
2
 
3
3
  module Yt
4
+ # @private
4
5
  module Associations
6
+ # @private
5
7
  module HasAttribute
6
8
  def self.included(base)
7
9
  base.extend(ClassMethods)
@@ -1,5 +1,6 @@
1
1
  module Yt
2
2
  module Associations
3
+ # @private
3
4
  # Provides authentication methods to YouTube resources, which allows to
4
5
  # access to content detail set-specific methods like `access_token`.
5
6
  #
@@ -16,6 +17,7 @@ module Yt
16
17
  end
17
18
  end
18
19
 
20
+ # @private
19
21
  module Authenticable
20
22
  delegate :access_token, :refresh_token, :expires_at, to: :authentication
21
23
 
@@ -1,5 +1,6 @@
1
1
  module Yt
2
2
  module Associations
3
+ # @private
3
4
  # Associations are a set of macro-like class methods to express
4
5
  # relationship between YouTube resources like "Channel has many Videos" or
5
6
  # "Account has one Id". They are inspired by ActiveRecord::Associations.
@@ -1,5 +1,6 @@
1
1
  module Yt
2
2
  module Associations
3
+ # @private
3
4
  # Associations are a set of macro-like class methods to express
4
5
  # relationship between YouTube resources like "Channel has many Videos" or
5
6
  # "Account has one Id". They are inspired by ActiveRecord::Associations.