yt 0.5.13 → 0.5.14
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/Gemfile.lock +1 -1
- data/README.md +8 -50
- data/lib/yt/collections/authentications.rb +1 -0
- data/lib/yt/version.rb +1 -1
- data/spec/associations/device_auth/authentications_spec.rb +1 -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: cc8bf39c826412cf4ebac40de897b1e6d298d3db
|
|
4
|
+
data.tar.gz: 56a50c740682435e1cf6640e13b1f456f85f7ef7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f23bdaf43476b944abfe8a0614cd381f4a340929aee7e480425a07f62ce4dbed0e76d5e65b4f15e22a4098fdee392de0b9e4b39492ddb4c28cb9fdab60ea2fa0
|
|
7
|
+
data.tar.gz: 5a3629db8476e76a4a37dbbb457f85a43a800149d7f31d8f9eb16cec181ee6d8f2be5ed5c5bb4e0dfa049750b3a919104cff4ad905f4d59d513d90eeafa0d9ce
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Yt helps you write apps that need to interact with the YouTube API V3.
|
|
|
10
10
|
[](https://codeclimate.com/github/Fullscreen/yt)
|
|
11
11
|
[](http://inch-pages.github.io/github/Fullscreen/yt)
|
|
12
12
|
|
|
13
|
-
After [registering your app](#
|
|
13
|
+
After [registering your app](#configuring-your-app), you can run commands like:
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
16
|
channel = Yt::Channel.new id: 'UCxO1tY8h1AhOz0T4ENwmpow'
|
|
@@ -226,8 +226,8 @@ so you won’t be able to like a video, subscribe to a channel or delete a
|
|
|
226
226
|
playlist from a specific account. You will only be able to retrieve read-only
|
|
227
227
|
data.
|
|
228
228
|
|
|
229
|
-
Web apps that
|
|
230
|
-
|
|
229
|
+
Web apps that require user interactions
|
|
230
|
+
---------------------------------------
|
|
231
231
|
|
|
232
232
|
If you are building a web app that manages YouTube accounts, you need the
|
|
233
233
|
owner of each account to authorize your app. There are three scenarios:
|
|
@@ -287,52 +287,10 @@ account.email #=> (retrieves the account’s e-mail address)
|
|
|
287
287
|
account.playlists.first.add_video 'MESycYJytkU' #=> (adds a video to an account’s playlist)
|
|
288
288
|
```
|
|
289
289
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
These apps are equivalent to web apps. The only difference is the interface
|
|
294
|
-
that Google uses to ask people to authenticate.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
Scenario 1. If you already have the account’s **access token**, then you are ready to go.
|
|
298
|
-
Just pass that access token to the account initializer, such as:
|
|
299
|
-
|
|
300
|
-
```ruby
|
|
301
|
-
account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
|
|
302
|
-
account.email #=> (retrieves the account’s e-mail address)
|
|
303
|
-
account.playlists.first.add_video 'MESycYJytkU' #=> (adds a video to an account’s playlist)
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Scenario 2. If you don’t have the account’s access token, but you have the
|
|
307
|
-
**refresh token**, then it’s almost as easy.
|
|
308
|
-
Open the [Google Developers Console](https://console.developers.google.com),
|
|
309
|
-
find the client ID and client secret of the **native application** that you used to obtain the
|
|
310
|
-
refresh token, then add the following snippet of code to the initializer of your app:
|
|
311
|
-
|
|
312
|
-
```ruby
|
|
313
|
-
Yt.configure do |config|
|
|
314
|
-
config.client_id = '1234567890.apps.googleusercontent.com'
|
|
315
|
-
config.client_secret = '1234567890'
|
|
316
|
-
end
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
replacing the values above with the client ID and secret for web application.
|
|
320
|
-
Then you can manage a YouTube account by passing the refresh token to the
|
|
321
|
-
account initializer, such as:
|
|
322
|
-
|
|
323
|
-
```ruby
|
|
324
|
-
account = Yt::Account.new refresh_token: '1/1234567890'
|
|
325
|
-
account.email #=> (retrieves the account’s e-mail address)
|
|
326
|
-
account.playlists.first.add_video 'MESycYJytkU' #=> (adds a video to an account’s playlist)
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
Scenario 3. If you don’t have the account’s refresh token, then [..TODO..]
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
Configuring your app through environment variables
|
|
333
|
-
==================================================
|
|
290
|
+
Configuring with environment variables
|
|
291
|
+
--------------------------------------
|
|
334
292
|
|
|
335
|
-
As an alternative to the approach above, you can configure
|
|
293
|
+
As an alternative to the approach above, you can configure your app with
|
|
336
294
|
variables. Setting the following environment variables:
|
|
337
295
|
|
|
338
296
|
```bash
|
|
@@ -342,7 +300,7 @@ export YT_CLIENT_SECRET="1234567890"
|
|
|
342
300
|
export YT_API_KEY="123456789012345678901234567890"
|
|
343
301
|
```
|
|
344
302
|
|
|
345
|
-
is equivalent to
|
|
303
|
+
is equivalent to configuring your app with the initializer:
|
|
346
304
|
|
|
347
305
|
```ruby
|
|
348
306
|
Yt.configure do |config|
|
|
@@ -365,7 +323,7 @@ To install on your system, run
|
|
|
365
323
|
|
|
366
324
|
To use inside a bundled Ruby project, add this line to the Gemfile:
|
|
367
325
|
|
|
368
|
-
gem 'yt', '~> 0.5.
|
|
326
|
+
gem 'yt', '~> 0.5.14'
|
|
369
327
|
|
|
370
328
|
Since the gem follows [Semantic Versioning](http://semver.org),
|
|
371
329
|
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
data/lib/yt/version.rb
CHANGED
|
@@ -11,6 +11,7 @@ describe Yt::Associations::Authentications, :device_app do
|
|
|
11
11
|
context 'that is valid' do
|
|
12
12
|
let(:refresh_token) { ENV['YT_TEST_DEVICE_REFRESH_TOKEN'] }
|
|
13
13
|
it { expect(account.authentication).to be_a Yt::Authentication }
|
|
14
|
+
it { expect(account.refresh_token).to eq refresh_token }
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
context 'that is invalid' do
|
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.5.
|
|
4
|
+
version: 0.5.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Baccigalupo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-06-
|
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|