yt-core 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -22
  3. data/.rspec +3 -0
  4. data/.travis.yml +8 -0
  5. data/.yardopts +3 -0
  6. data/CHANGELOG.md +11 -0
  7. data/Gemfile +2 -1
  8. data/LICENSE.txt +17 -18
  9. data/README.md +81 -17
  10. data/Rakefile +8 -1
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/docs/_config.yml +10 -0
  14. data/docs/_includes/doc.html +1 -0
  15. data/docs/_includes/dt.html +4 -0
  16. data/docs/_includes/example.html +1 -0
  17. data/docs/_includes/footer.html +3 -0
  18. data/docs/_includes/head.html +21 -0
  19. data/docs/_includes/header.html +57 -0
  20. data/docs/_layouts/default.html +58 -0
  21. data/docs/apple-touch-icon-precomposed.png +0 -0
  22. data/docs/channels.html +142 -0
  23. data/docs/css/yt.css +40 -0
  24. data/docs/errors.html +28 -0
  25. data/docs/favicon.ico +0 -0
  26. data/docs/fonts/SecondaRound-Bold.eot +0 -0
  27. data/docs/fonts/SecondaRound-Bold.svg +2160 -0
  28. data/docs/fonts/SecondaRound-Bold.ttf +0 -0
  29. data/docs/fonts/SecondaRound-Bold.woff +0 -0
  30. data/docs/fonts/SecondaRound-Bold.woff2 +0 -0
  31. data/docs/fonts/SecondaRound-Regular.eot +0 -0
  32. data/docs/fonts/SecondaRound-Regular.svg +1873 -0
  33. data/docs/fonts/SecondaRound-Regular.ttf +0 -0
  34. data/docs/fonts/SecondaRound-Regular.woff +0 -0
  35. data/docs/fonts/SecondaRound-Regular.woff2 +0 -0
  36. data/docs/images/console-01.png +0 -0
  37. data/docs/images/console-02.png +0 -0
  38. data/docs/images/console-03.png +0 -0
  39. data/docs/images/console-04.png +0 -0
  40. data/docs/images/console-05.png +0 -0
  41. data/docs/images/console-06.png +0 -0
  42. data/docs/images/console-07.png +0 -0
  43. data/docs/images/logo.png +0 -0
  44. data/docs/images/robot.png +0 -0
  45. data/docs/images/robots.png +0 -0
  46. data/docs/index.html +37 -0
  47. data/docs/playlist_items.html +65 -0
  48. data/docs/playlists.html +114 -0
  49. data/docs/urls.html +52 -0
  50. data/docs/videos.html +104 -0
  51. data/lib/yt/channel.rb +127 -0
  52. data/lib/yt/core/version.rb +8 -0
  53. data/lib/yt/core.rb +18 -0
  54. data/lib/yt/no_items_error.rb +8 -0
  55. data/lib/yt/playlist.rb +75 -0
  56. data/lib/yt/playlist_item.rb +59 -0
  57. data/lib/yt/relation.rb +100 -0
  58. data/lib/yt/resource.rb +85 -0
  59. data/lib/yt/response.rb +91 -0
  60. data/lib/yt/video.rb +216 -0
  61. data/yt-core.gemspec +27 -15
  62. metadata +155 -19
  63. data/lib/yt-core/version.rb +0 -3
  64. data/lib/yt-core.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e73785b5cd82fa51ecccf38582af03f6a189fdf
4
- data.tar.gz: d7dbbcded0e7bcf83b66ef6efe52ff48255b489f
3
+ metadata.gz: 28bc8c7b5dc7f93aba21e4190057758cd3bc63a9
4
+ data.tar.gz: 0fb9a20cba7679958c00e73bbb96d8dd9b4ba613
5
5
  SHA512:
6
- metadata.gz: fe370fafb6f8ad53ca302f93bd537b75fbaaf8a4cffe05605328463bf699dd7ba0ff42538d45a111259b6d7ba9c4885ab9310133864de75b43cc4f61be3520c3
7
- data.tar.gz: ecbb7e2216d4b974e3e1046e2c1652a6146f359a2c81f6a7eecbaba56e44330f08f776b3f59538ff82bdf02990f80a8849370c485f373e622de3dc5d9b81f25b
6
+ metadata.gz: 7e38e38ea200bda2994b4cb4b2a57d4d6b8dde5c1e8150c275ca8ad4a8410451d06380f47de81583ba3d7a87e7f5ed076dcf94447069ec8a0d0b6bf1717a9429
7
+ data.tar.gz: f894f69ac4dca2029574d16d8b5fe3fd708cf18a864218bafe08fa7553338ebfc521584664ae3a88d4c363fcc82bf91b4fe6d78bfad054ff02637f73512ff881
data/.gitignore CHANGED
@@ -1,22 +1,14 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ _site
11
+ .sass-cache
12
+ pkg/
13
+ .jekyll-metadata
14
+
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --fail-fast
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ notifications:
3
+ email: false
4
+ rvm:
5
+ - 2.2.2
6
+ script:
7
+ - bundle exec rspec
8
+ - bundle exec yard stats | grep "100.00% documented"
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --non-transitive-tag private
2
+ --no-private
3
+ lib/**/*.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ For more information about changelogs, check
6
+ [Keep a Changelog](http://keepachangelog.com) and
7
+ [Vandamme](http://tech-angels.github.io/vandamme).
8
+
9
+ ## 0.1.0 - 2017-04-03
10
+
11
+ * [FEATURE] Extracted first classes from Yt
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in yt-core.gemspec
3
+ gem 'pry-nav'
4
+ # Specify your gem's dependencies in yt.gemspec
4
5
  gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2014 claudiob
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2014-present Fullscreen, Inc.
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,29 +1,93 @@
1
- # YtCore
1
+ Yt - a Ruby client for the YouTube API
2
+ ======================================
2
3
 
3
- TODO: Write a gem description
4
+ Yt helps you write apps that need to interact with YouTube.
4
5
 
5
- ## Installation
6
+ The **source code** is available on [GitHub](https://github.com/fullscreen/yt-core) and the **documentation** on [RubyDoc](http://www.rubydoc.info/gems/yt-core/frames).
6
7
 
7
- Add this line to your application's Gemfile:
8
+ [![Build Status](http://img.shields.io/travis/Fullscreen/yt-core/master.svg)](https://travis-ci.org/Fullscreen/yt-core)
9
+ [![Coverage Status](http://img.shields.io/coveralls/Fullscreen/yt-core/master.svg)](https://coveralls.io/r/Fullscreen/yt-core)
10
+ [![Dependency Status](http://img.shields.io/gemnasium/Fullscreen/yt-core.svg)](https://gemnasium.com/Fullscreen/yt-core)
11
+ [![Code Climate](http://img.shields.io/codeclimate/github/Fullscreen/yt-core.svg)](https://codeclimate.com/github/Fullscreen/yt-core)
12
+ [![Online docs](http://img.shields.io/badge/docs-✓-green.svg)](http://www.rubydoc.info/gems/yt-core/frames)
13
+ [![Gem Version](http://img.shields.io/gem/v/yt.svg)](http://rubygems.org/gems/yt-core)
8
14
 
9
- gem 'yt-core'
15
+ After [registering your app](https://fullscreen.github.io/yt-core/), you can run commands like:
10
16
 
11
- And then execute:
17
+ ```ruby
18
+ channel = Yt::Channel.new id: 'UCwCnUcLcb9-eSrHa_RQGkQQ'
19
+ channel.title #=> "Yt Test"
20
+ ```
12
21
 
13
- $ bundle
22
+ The **full documentation** is available at [rubydoc.info](http://www.rubydoc.info/gems/yt-core/frames).
14
23
 
15
- Or install it yourself as:
16
24
 
17
- $ gem install yt-core
25
+ A comprehensive guide to Yt
26
+ ===========================
18
27
 
19
- ## Usage
28
+ All the classes and methods available are detailed on the [Yt homepage](https://fullscreen.github.io/yt-core/):
20
29
 
21
- TODO: Write usage instructions here
30
+ [![Yt homepage](https://cloud.githubusercontent.com/assets/10076/19788369/b61d7756-9c5c-11e6-8bd8-05f8d67aef4e.png)](https://fullscreen.github.io/yt-core/)
22
31
 
23
- ## Contributing
32
+ Please proceed to [https://fullscreen.github.io/yt-core](https://fullscreen.github.io/yt-core/) for more details and examples.
24
33
 
25
- 1. Fork it ( https://github.com/[my-github-username]/yt-core/fork )
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create a new Pull Request
34
+
35
+ How to install
36
+ ==============
37
+
38
+ To install on your system, run
39
+
40
+ gem install yt-core
41
+
42
+ To use inside a bundled Ruby project, add this line to the Gemfile:
43
+
44
+ gem 'yt-core', '~> 0.1.0'
45
+
46
+ Since the gem follows [Semantic Versioning](http://semver.org),
47
+ indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
48
+ guarantees that your project won’t occur in any error when you `bundle update`
49
+ and a new version of Yt is released.
50
+
51
+ How to test
52
+ ===========
53
+
54
+ To run live-tests against the YouTube API, type:
55
+
56
+ ```bash
57
+ rspec
58
+ ```
59
+
60
+ This will fail unless you have set up a test YouTube application with access to
61
+ the YouTube Data API v3 and an environment variable:
62
+
63
+ - `YT_SERVER_API_KEY`: API Key of a Google app with access to the YouTube Data API v3 and the YouTube Analytics API
64
+
65
+
66
+ How to release new versions
67
+ ===========================
68
+
69
+ If you are a manager of this project, remember to upgrade the [Yt gem](http://rubygems.org/gems/yt)
70
+ whenever a new feature is added or a bug gets fixed.
71
+
72
+ Make sure all the tests are passing on [Travis CI](https://travis-ci.org/Fullscreen/yt-core),
73
+ document the changes in HISTORY.md and README.md, bump the version, then run
74
+
75
+ rake release
76
+
77
+ Remember that the yt gem follows [Semantic Versioning](http://semver.org).
78
+ Any new release that is fully backward-compatible should bump the *patch* version (0.0.x).
79
+ Any new version that breaks compatibility should bump the *minor* version (0.x.0)
80
+
81
+ How to contribute
82
+ =================
83
+
84
+ Contribute to the code by forking the project, adding the missing code,
85
+ writing the appropriate tests and submitting a pull request.
86
+
87
+ In order for a PR to be approved, all the tests need to pass and all the public
88
+ methods need to be documented and listed in the guides. Remember:
89
+
90
+ - to run all tests locally: `bundle exec rspec`
91
+ - to generate the docs locally: `bundle exec yard`
92
+ - to list undocumented methods: `bundle exec yard stats --list-undoc`
93
+ - to launch the guides locally: `bundle exec jekyll s -s docs`
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
 
3
+ require "rspec/core/rake_task"
4
+ require "rspec/core/version"
5
+
6
+ desc "Run all examples"
7
+ RSpec::Core::RakeTask.new :spec
8
+
9
+ task default: [:spec]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "yt"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docs/_config.yml ADDED
@@ -0,0 +1,10 @@
1
+ markdown: kramdown
2
+ permalink: none
3
+ baseurl: /yt-core
4
+ defaults:
5
+ -
6
+ scope:
7
+ path: ""
8
+ values:
9
+ layout: "default"
10
+ version: 0.0.0
@@ -0,0 +1 @@
1
+ <a href="http://www.rubydoc.info/github/claudiob/{% if include.library %}{{ include.library }}{% else %}yt{% endif %}/master/Yt/{% if include.instance %}{{ include.instance }}-instance{% elsif include.class %}{{ include.class }}-class{% endif %}_method" class="pull-right"><strong>&rarr; Yt docs</strong></a>
@@ -0,0 +1,4 @@
1
+ <dt>
2
+ <span class="label label-{{ include.label }} pull-right">{{ include.auth }}</span>
3
+ {{ include.title }}
4
+ </dt>
@@ -0,0 +1 @@
1
+ <code class="language-ruby" data-lang="ruby">{% if include.object %}<span class="n">{{ include.object }}</span>{% if include.method %}<span class="o">.</span><span class="n">{{ include.method }}</span>{% endif %}{% endif %}{{ include.params }}{% if include.result %}{% if include.object %}&nbsp;{% endif %}<span class="c1"># =&gt; {{ include.result }}</span>{% endif %}</code>
@@ -0,0 +1,3 @@
1
+ <footer></footer>
2
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
3
+ <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script>
@@ -0,0 +1,21 @@
1
+ <head>
2
+ <meta charset="utf-8">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta name="description" content="Yt · The reliable YouTube API Ruby client">
6
+ <meta name="keywords" content="YouTube, Rails, youtube_it, API, V3, Ruby, client, video, channel, OAuth">
7
+ <meta name="author" content="Claudio B.">
8
+ <title>Yt · The reliable YouTube API Ruby client{% if page.title %} · {{ page.title }}{% endif %}</title>
9
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
10
+ <link rel="stylesheet" href="{{ site.baseurl }}/css/yt.css">
11
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
12
+ <!--[if lt IE 9]>
13
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
14
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
15
+ <![endif]-->
16
+ <link href="{{ site.baseurl }}/apple-touch-icon-precomposed.png" rel="apple-touch-icon-precomposed">
17
+ <link href="{{ site.baseurl }}/favicon.ico" rel="icon">
18
+
19
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
20
+ <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script>
21
+ </head>
@@ -0,0 +1,57 @@
1
+ <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
2
+ <div class="container">
3
+ <div class="navbar-header">
4
+ <button class="navbar-toggle" data-target="#navbar-collapse-1" data-toggle="collapse" type="button">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+
11
+ <a class="navbar-brand" href="{{ site.baseurl }}/">
12
+ <img alt="Yt" src="{{ site.baseurl }}/images/robot.png">
13
+ Yt<span class="hidden-xs"> · The reliable YouTube API Ruby client</span>
14
+ </a>
15
+ </div>
16
+
17
+ <div class="collapse navbar-collapse" id="navbar-collapse-1">
18
+ <ul class="nav navbar-nav navbar-right visible-xs-block">
19
+ {% if page.url == '/' %}
20
+ <li class="active"><a href="{{ site.baseurl }}/">Installing Yt</a></li>
21
+ {% else %}
22
+ <li><a href="{{ site.baseurl }}/">Installing Yt</a></li>
23
+ {% endif %}
24
+ {% if page.url == '/channels.html' %}
25
+ <li class="active"><a href="{{ site.baseurl }}/channels.html">Channels</a></li>
26
+ {% else %}
27
+ <li><a href="{{ site.baseurl }}/channels.html">Channels</a></li>
28
+ {% endif %}
29
+ {% if page.url == '/videos.html' %}
30
+ <li class="active"><a href="{{ site.baseurl }}/videos.html">Videos</a></li>
31
+ {% else %}
32
+ <li><a href="{{ site.baseurl }}/videos.html">Videos</a></li>
33
+ {% endif %}
34
+ {% if page.url == '/playlists.html' %}
35
+ <li class="active"><a href="{{ site.baseurl }}/playlists.html">Playlists</a></li>
36
+ {% else %}
37
+ <li><a href="{{ site.baseurl }}/playlists.html">Playlists</a></li>
38
+ {% endif %}
39
+ {% if page.url == '/playlist_items.html' %}
40
+ <li class="active"><a href="{{ site.baseurl }}/playlist_items.html">Playlist Items</a></li>
41
+ {% else %}
42
+ <li><a href="{{ site.baseurl }}/playlist_items.html">Playlist Items</a></li>
43
+ {% endif %}
44
+ {% if page.url == '/errors.html' %}
45
+ <li class="active"><a href="{{ site.baseurl }}/errors.html">Errors</a></li>
46
+ {% else %}
47
+ <li><a href="{{ site.baseurl }}/errors.html">Errors</a></li>
48
+ {% endif %}
49
+ {% if page.url == '/urls.html' %}
50
+ <li class="active"><a href="{{ site.baseurl }}/urls.html">URLs</a></li>
51
+ {% else %}
52
+ <li><a href="{{ site.baseurl }}/urls.html">URLs</a></li>
53
+ {% endif %}
54
+ </ul>
55
+ </div>
56
+ </div>
57
+ </nav>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ {% include head.html %}
4
+ <body>
5
+ {% include header.html %}
6
+ <main>
7
+ <div class="container">
8
+ <div class="row">
9
+ <div class="hidden-xs hidden-print col-sm-3" role="complementary">
10
+ <ol start="0" class="sidebar" data-spy="affix">
11
+ {% if page.url == '/' %}
12
+ <li><a href="{{ site.baseurl }}/" class="active">Installing Yt</a></li>
13
+ {% else %}
14
+ <li><a href="{{ site.baseurl }}/">Installing Yt</a></li>
15
+ {% endif %}
16
+ {% if page.url == '/channels.html' %}
17
+ <li><a href="{{ site.baseurl }}/channels.html" class="active">Channels</a></li>
18
+ {% else %}
19
+ <li><a href="{{ site.baseurl }}/channels.html">Channels</a></li>
20
+ {% endif %}
21
+ {% if page.url == '/videos.html' %}
22
+ <li><a href="{{ site.baseurl }}/videos.html" class="active">Videos</a></li>
23
+ {% else %}
24
+ <li><a href="{{ site.baseurl }}/videos.html">Videos</a></li>
25
+ {% endif %}
26
+ {% if page.url == '/playlists.html' %}
27
+ <li><a href="{{ site.baseurl }}/playlists.html" class="active">Playlists</a></li>
28
+ {% else %}
29
+ <li><a href="{{ site.baseurl }}/playlists.html">Playlists</a></li>
30
+ {% endif %}
31
+ {% if page.url == '/playlist_items.html' %}
32
+ <li><a href="{{ site.baseurl }}/playlist_items.html" class="active">Playlist Items</a></li>
33
+ {% else %}
34
+ <li><a href="{{ site.baseurl }}/playlist_items.html">Playlist Items</a></li>
35
+ {% endif %}
36
+ {% if page.url == '/errors.html' %}
37
+ <li><a href="{{ site.baseurl }}/errors.html" class="active">Errors</a></li>
38
+ {% else %}
39
+ <li><a href="{{ site.baseurl }}/errors.html">Errors</a></li>
40
+ {% endif %}
41
+ {% if page.url == '/urls.html' %}
42
+ <li><a href="{{ site.baseurl }}/urls.html" class="active">URLs</a></li>
43
+ {% else %}
44
+ <li><a href="{{ site.baseurl }}/urls.html">URLs</a></li>
45
+ {% endif %}
46
+ </ol>
47
+
48
+ </div>
49
+ <div class="col-xs-12 col-sm-9" role="main">
50
+ <h2>{{ page.h2 }}</h2>
51
+ {{ content }}
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </main>
56
+ {% include footer.html %}
57
+ </body>
58
+ </html>
@@ -0,0 +1,142 @@
1
+ ---
2
+ title: "Yt::Channel"
3
+ h2: "Channels"
4
+ ---
5
+
6
+ <p>
7
+ <code>Yt::Channel</code> represents a <a href="https://developers.google.com/youtube/v3/docs/channels">YouTube channel</a>.
8
+ Initialize using its YouTube ID:
9
+ </p>
10
+
11
+ <dl>
12
+ <dd><a class="anchor" id="new"></a><div class="highlight"><pre>
13
+ {% include doc.html instance="Channel#initialize" %}{% include example.html object='channel = <span class="no">Yt</span><span class="o">::</span><span class="no">Channel</span>' method='new' params=' <span class="ss">id:</span> <span class="s1">"UCwCnUcLcb9-eSrHa_RQGkQQ"</span>' %}
14
+ {% include example.html result='#&lt;Yt::Channel @id=UCwCnUcLcb9-eSrHa_RQGkQQ&gt;' %}
15
+ {% include doc.html instance="Channel#canonical_url" %}{% include example.html object='channel' method='canonical_url' %}
16
+ {% include example.html result='"https://www.youtube.com/channel/UCwCnUcLcb9-eSrHa_RQGkQQ"' %}</pre>
17
+ </div></dd>
18
+ </dl>
19
+
20
+ <hr />
21
+ <h4>Authentication</h4>
22
+
23
+ <p>
24
+ Most methods of <code>Yt::Channel</code> <strong>retrieve public data</strong> from YouTube (e.g.: fetch a channel’s title).<br />
25
+ To use these methods (marked with <span class="label label-success">&nbsp;</span> below), you only need to <a href="{{ site.baseurl }}/#api_key">generate an API key</a> and configure:
26
+ </p>
27
+
28
+ {% highlight ruby %}
29
+ Yt.configuration.api_key = "<your api key>" ## use your API key
30
+
31
+ channel = Yt::Channel.new id: 'UCwCnUcLcb9-eSrHa_RQGkQQ' ## use any channel ID
32
+ channel.title # => "Yt Test"
33
+ {% endhighlight %}
34
+
35
+ <hr />
36
+ <h4>List of <code>Yt::Channel</code> data methods</h4>
37
+ <dl>
38
+ {% include dt.html title="Channel’s snippet" label="success" auth="any authentication works" %}
39
+ <dd><a class="anchor" id="snippet"></a><div class="highlight"><pre>
40
+ {% include doc.html instance="Channel#id" %}{% include example.html object='channel' method='id' result='"UCwCnUcLcb9-eSrHa_RQGkQQ"' %}
41
+ {% include doc.html instance="Channel#title" %}{% include example.html object='channel' method='title' result='"Yt Test"' %}
42
+ {% include doc.html instance="Channel#description" %}{% include example.html object='channel' method='description' result='"A test channel."' %}
43
+ {% include doc.html instance="Channel#custom_url" %}{% include example.html object='channel' method='custom_url' result='"yt-test"' %}
44
+ {% include doc.html instance="Channel#vanity_url" %}{% include example.html object='channel' method='vanity_url' result='"https://www.youtube.com/yt-test"' %}
45
+ {% include doc.html instance="Channel#published_at" %}{% include example.html object='channel' method='published_at' result='2014-05-02 20:12:57 UTC' %}
46
+ {% include doc.html instance="Channel#thumbnail_url" %}{% include example.html object='channel' method='thumbnail_url' result='"https://yt3.ggpht.com/-KMnbKDBl60w/photo.jpg"' %}</pre>
47
+ </div></dd>
48
+
49
+ {% include dt.html title="Channel’s status" label="success" auth="any authentication works" %}
50
+ <dd><a class="anchor" id="status"></a><div class="highlight"><pre>
51
+ {% include doc.html instance="Channel#privacy_status" %}{% include example.html object='channel' method='privacy_status' result='"public"' %}
52
+ {% include doc.html instance="Channel#is_linked" %}{% include example.html object='channel' method='is_linked' result='true' %}
53
+ {% include doc.html instance="Channel#long_uploads_status" %}{% include example.html object='channel' method='long_uploads_status' result='"longUploadsUnspecified"' %}</pre>
54
+ </div></dd>
55
+
56
+ {% include dt.html title="Channel’s statistics" label="success" auth="any authentication works" %}
57
+ <dd><a class="anchor" id="statistics"></a><div class="highlight"><pre>
58
+ {% include doc.html instance="Channel#view_count" %}{% include example.html object='channel' method='view_count' result='123' %}
59
+ {% include doc.html instance="Channel#comment_count" %}{% include example.html object='channel' method='comment_count' result='93' %}
60
+ {% include doc.html instance="Channel#subscriber_count" %}{% include example.html object='channel' method='subscriber_count' result='42' %}
61
+ {% include doc.html instance="Channel#hidden_subscriber_count" %}{% include example.html object='channel' method='hidden_subscriber_count' result='false' %}
62
+ {% include doc.html instance="Channel#video_count" %}{% include example.html object='channel' method='video_count' result='62' %}</pre>
63
+ </div></dd>
64
+
65
+ {% include dt.html title="Channel’s branding settings" label="success" auth="any authentication works" %}
66
+ <dd><a class="anchor" id="branding_settings"></a><div class="highlight"><pre>
67
+ {% include doc.html instance="Channel#banner_image_url" %}{% include example.html object='channel' method='banner_image_url' result='"https://yt3.ggpht.com/9dh4rj-k-no"' %}
68
+ {% include doc.html instance="Channel#keywords" %}{% include example.html object='channel' method='keywords' result='["Some", "tag"]' %}
69
+ {% include doc.html instance="Channel#unsubscribed_trailer" %}{% include example.html object='channel' method='unsubscribed_trailer' result='"gknzFj_0vvY"' %}</pre>
70
+ </div></dd>
71
+ </dl>
72
+ <p>
73
+ To limit the number of HTTP requests, use <code>select</code> to specify which <a href="https://developers.google.com/youtube/v3/docs/channels/list#part">parts</a> of the channel’s data to load:
74
+ </p>
75
+ <dl>
76
+ <dd><a class="anchor" id="select"></a><div class="highlight"><pre>
77
+ {% include example.html object='slow = channel' result='without select: 2 HTTP requests' %}
78
+ {% include example.html object='slow' method='title' result='one HTTP request to fetch the channel’s snippet' %}
79
+ {% include example.html object='slow' method='privacy_status' result='another HTTP request to fetch the channel’s status' %}
80
+
81
+ {% include doc.html instance="Channel#select" %}{% include example.html object='fast = channel' method='select' params=' <span class="ss">:snippet</span><span class="p">,</span> <span class="ss">:status</span>' result='with select: 1 HTTP request' %}
82
+ {% include example.html object='fast' method='title' result='one HTTP request to fetch both the channel’s snippet and status' %}
83
+ {% include example.html object='fast' method='privacy_status' result='no extra HTTP requests' %}</pre>
84
+ </div></dd>
85
+ </dl>
86
+
87
+ <dl>
88
+ {% include dt.html title="Channel’s (public) videos" label="success" auth="any authentication works" %}
89
+ <dd><a class="anchor" id="videos"></a><div class="highlight"><pre>
90
+ {% include doc.html instance="Channel#videos" %}{% include example.html object='channel' method='videos' %}
91
+ {% include example.html result='#&lt;Yt::Relation [#&lt;Yt::Video @id=gknz...&gt;, #&lt;Yt::Video @id=32Gc...&gt;, ...]&gt;' %}</pre>
92
+ </div></dd>
93
+ </dl>
94
+ <dl>
95
+ {% include dt.html title="Channel’s (public) playlists" label="success" auth="any authentication works" %}
96
+ <dd><a class="anchor" id="playlists"></a><div class="highlight"><pre>
97
+ {% include doc.html instance="Channel#playlists" %}{% include example.html object='channel' method='playlists' %}
98
+ {% include example.html result='#&lt;Yt::Relation [#&lt;Yt::Playlist @id=PL-L...&gt;, #&lt;Yt::Playlist @id=PL-N...&gt;, ...]&gt;' %}</pre>
99
+ </div></dd>
100
+ </dl>
101
+ <p>
102
+ Before iterating through videos or playlists, use <code>select</code> to specify which <a href="https://developers.google.com/youtube/v3/docs/videos/list#part">parts</a> of each video’s data to load:
103
+ </p>
104
+ <dl>
105
+ <dd><a class="anchor" id="select"></a><div class="highlight"><pre>
106
+ {% include doc.html instance="Relation#select" %}{% include example.html object='videos = channel.videos' method='select' params=' <span class="ss">:snippet</span>, <span class="ss">:statistics</span>' %}
107
+ {% include example.html object='videos' method='map <span class="ss">&amp;:title</span>' result='["First public video", "Second public video", ...]' %}
108
+ {% include example.html object='videos' method='map <span class="ss">&amp;:view_count</span>' result='[123, 456, ...]' %}</pre>
109
+ </div></dd>
110
+ </dl>
111
+ <p>
112
+ You can also use <code>limit</code> to only fetch a certain number of videos or playlists:
113
+ </p>
114
+ <dl>
115
+ <dd><a class="anchor" id="limit"></a><div class="highlight"><pre>
116
+ {% include doc.html instance="Relation#limit" %}{% include example.html object='videos = channel.videos' method='limit' params=' <span class="mi">2</span>' %}
117
+ {% include example.html object='videos' method='map <span class="ss">&amp;:id</span>' result='["gknzFj_0vvY", "oO6WawhsxTA"]' %}</pre>
118
+ </div></dd>
119
+ </dl>
120
+ <p>
121
+ You can also use <code>size</code> to quickly obtain the estimated number of videos or playlists:
122
+ </p>
123
+ <dl>
124
+ <dd><a class="anchor" id="size"></a><div class="highlight"><pre>
125
+ {% include doc.html instance="Relation#size" %}{% include example.html object='channel.videos' method='size' result='312' %}</pre>
126
+ </div></dd>
127
+ </dl>
128
+ <p>
129
+ Note that, due to <a href="https://developers.google.com/youtube/v3/docs/search/list#channelId">YouTube API limitations</a>, only a maximum of 500 videos can be fetched for an unauthenticated channel.
130
+ </p>
131
+
132
+ <dl>
133
+ {% include dt.html title="Collection of channels" label="success" auth="any authentication works" %}
134
+ <dd><a class="anchor" id="where"></a><div class="highlight"><pre>
135
+ {% include doc.html class="Channel#where" %}{% include example.html object='<span class="no">Yt</span><span class="o">::</span><span class="no">Channel</span>' method='where' params=' <span class="ss">id:</span> [<span class="s1">"UCwCnUcLcb9-eSrHa_RQGkQQ"</span>, <span class="s1">"UCKe_0fJtkT1dYnzn"</span>, ...]' %}
136
+ {% include example.html result='#&lt;Yt::Relation [#&lt;Yt::Channel @id=UCwCnUcLcb9-eSrHa_RQGkQQ&gt;, ...]&gt;' %}</pre>
137
+ </div></dd>
138
+ </dl>
139
+ <p>
140
+ The previous method returns existing channels that match the provided IDs, skipping any unrecognized ID.<br />
141
+ As usual, use <code>select</code> to specify which <a href="https://developers.google.com/youtube/v3/docs/channels/list#part">parts</a> of each channels’s data to load before iterating through the list.
142
+ </p>