yt 0.29.1 → 0.30.0
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/CHANGELOG.md +12 -0
- data/lib/yt/version.rb +1 -1
- data/yt.gemspec +1 -0
- metadata +17 -7
- data/lib/yt/config.rb +0 -54
- data/lib/yt/models/configuration.rb +0 -70
- data/spec/models/configuration_spec.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22890be6fcf88d70b14168f20b39530ff6da0ea5
|
4
|
+
data.tar.gz: 4c0304956d2d35b4724e4a9e4f4d01336fbd9fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f471cb92a4cb30eb0d38869d6eb1e520f007887c067e36c19bd95fa4f93ea61430e5457fbc0ef38de91130bcf28c35bc1d13260b5a6bd80a7faf4058e9f26ee
|
7
|
+
data.tar.gz: 36560c948ba3b1f57383170f47dd889f64d10ec1cf8313851466233ebf0f2b37dba8b40706205552d76b4a245bbe760d1d9e74747a310d7fb40d521c1524ad95
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ 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.30.0 - 2017-03-17
|
10
|
+
|
11
|
+
**How to upgrade**
|
12
|
+
|
13
|
+
If your code uses `Yt::Models::Configuration` then you must use
|
14
|
+
`Yt::Configuration` instead.
|
15
|
+
|
16
|
+
Both `Yt::Configuration` and `Yt::Config` have been moved in a separate
|
17
|
+
gem called `yt-support` that is required by default by the `yt` gem.
|
18
|
+
|
19
|
+
* [REMOVAL] Remove `Yt::Models::Configuration` (renamed as `Yt::Configuration`)
|
20
|
+
|
9
21
|
## 0.29.1 - 2017-02-26
|
10
22
|
|
11
23
|
* [FEATURE] Add `Video#length` to show the duration as an ISO 8601 time.
|
data/lib/yt/version.rb
CHANGED
data/yt.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency 'activesupport' # '3 (Ruby 1.9) or 4 (Ruby 2)'
|
25
|
+
spec.add_dependency 'yt-support', '>= 0.1'
|
25
26
|
|
26
27
|
# For development / Code coverage / Documentation
|
27
28
|
spec.add_development_dependency 'bundler' #, '~> 1.0'
|
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.
|
4
|
+
version: 0.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yt-support
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,7 +183,6 @@ files:
|
|
169
183
|
- lib/yt/collections/video_categories.rb
|
170
184
|
- lib/yt/collections/video_groups.rb
|
171
185
|
- lib/yt/collections/videos.rb
|
172
|
-
- lib/yt/config.rb
|
173
186
|
- lib/yt/constants/geography.rb
|
174
187
|
- lib/yt/errors/forbidden.rb
|
175
188
|
- lib/yt/errors/missing_auth.rb
|
@@ -191,7 +204,6 @@ files:
|
|
191
204
|
- lib/yt/models/claim_history.rb
|
192
205
|
- lib/yt/models/comment.rb
|
193
206
|
- lib/yt/models/comment_thread.rb
|
194
|
-
- lib/yt/models/configuration.rb
|
195
207
|
- lib/yt/models/content_detail.rb
|
196
208
|
- lib/yt/models/content_owner.rb
|
197
209
|
- lib/yt/models/content_owner_detail.rb
|
@@ -251,7 +263,6 @@ files:
|
|
251
263
|
- spec/models/claim_spec.rb
|
252
264
|
- spec/models/comment_spec.rb
|
253
265
|
- spec/models/comment_thread_spec.rb
|
254
|
-
- spec/models/configuration_spec.rb
|
255
266
|
- spec/models/content_detail_spec.rb
|
256
267
|
- spec/models/content_owner_detail_spec.rb
|
257
268
|
- spec/models/file_detail_spec.rb
|
@@ -326,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
337
|
version: '0'
|
327
338
|
requirements: []
|
328
339
|
rubyforge_project:
|
329
|
-
rubygems_version: 2.6.
|
340
|
+
rubygems_version: 2.6.11
|
330
341
|
signing_key:
|
331
342
|
specification_version: 4
|
332
343
|
summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,
|
@@ -357,7 +368,6 @@ test_files:
|
|
357
368
|
- spec/models/claim_spec.rb
|
358
369
|
- spec/models/comment_spec.rb
|
359
370
|
- spec/models/comment_thread_spec.rb
|
360
|
-
- spec/models/configuration_spec.rb
|
361
371
|
- spec/models/content_detail_spec.rb
|
362
372
|
- spec/models/content_owner_detail_spec.rb
|
363
373
|
- spec/models/file_detail_spec.rb
|
data/lib/yt/config.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'yt/models/configuration'
|
2
|
-
|
3
|
-
module Yt
|
4
|
-
# Provides methods to read and write global configuration settings.
|
5
|
-
#
|
6
|
-
# A typical usage is to set the API keys retrieved from the
|
7
|
-
# {http://console.developers.google.com Google Developers Console}.
|
8
|
-
#
|
9
|
-
# @example Set the API key for a server-only YouTube app:
|
10
|
-
# Yt.configure do |config|
|
11
|
-
# config.api_key = 'ABCDEFGHIJ1234567890'
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# @example Set the API client id/secret for a web-client YouTube app:
|
15
|
-
# Yt.configure do |config|
|
16
|
-
# config.client_id = 'ABCDEFGHIJ1234567890'
|
17
|
-
# config.client_secret = 'ABCDEFGHIJ1234567890'
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# Note that Yt.configure has precedence over values through with
|
21
|
-
# environment variables (see {Yt::Models::Configuration}).
|
22
|
-
#
|
23
|
-
module Config
|
24
|
-
# Yields the global configuration to the given block.
|
25
|
-
#
|
26
|
-
# @example
|
27
|
-
# Yt.configure do |config|
|
28
|
-
# config.api_key = 'ABCDEFGHIJ1234567890'
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# @yield [Yt::Models::Configuration] The global configuration.
|
32
|
-
def configure
|
33
|
-
yield configuration if block_given?
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns the global {Yt::Models::Configuration} object.
|
37
|
-
#
|
38
|
-
# While this method _can_ be used to read and write configuration settings,
|
39
|
-
# it is easier to use {Yt::Config#configure} Yt.configure}.
|
40
|
-
#
|
41
|
-
# @example
|
42
|
-
# Yt.configuration.api_key = 'ABCDEFGHIJ1234567890'
|
43
|
-
#
|
44
|
-
# @return [Yt::Models::Configuration] The global configuration.
|
45
|
-
def configuration
|
46
|
-
@configuration ||= Yt::Configuration.new
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# @note Config is the only module auto-loaded in the Yt module,
|
51
|
-
# in order to have a syntax as easy as Yt.configure
|
52
|
-
|
53
|
-
extend Config
|
54
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module Yt
|
2
|
-
module Models
|
3
|
-
# Provides an object to store global configuration settings.
|
4
|
-
#
|
5
|
-
# This class is typically not used directly, but by calling
|
6
|
-
# {Yt::Config#configure Yt.configure}, which creates and updates a single
|
7
|
-
# instance of {Yt::Models::Configuration}.
|
8
|
-
#
|
9
|
-
# @example Set the API client id/secret for a web-client YouTube app:
|
10
|
-
# Yt.configure do |config|
|
11
|
-
# config.client_id = 'ABCDEFGHIJ1234567890'
|
12
|
-
# config.client_secret = 'ABCDEFGHIJ1234567890'
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# @see Yt::Config for more examples.
|
16
|
-
#
|
17
|
-
# An alternative way to set global configuration settings is by storing
|
18
|
-
# them in the following environment variables:
|
19
|
-
#
|
20
|
-
# * +YT_CLIENT_ID+ to store the Client ID for web/device apps
|
21
|
-
# * +YT_CLIENT_SECRET+ to store the Client Secret for web/device apps
|
22
|
-
# * +YT_API_KEY+ to store the API key for server/browser apps
|
23
|
-
# * +YT_LOG_LEVEL+ to store the verbosity level of the logs
|
24
|
-
#
|
25
|
-
# In case both methods are used together,
|
26
|
-
# {Yt::Config#configure Yt.configure} takes precedence.
|
27
|
-
#
|
28
|
-
# @example Set the API client id/secret for a web-client YouTube app:
|
29
|
-
# ENV['YT_CLIENT_ID'] = 'ABCDEFGHIJ1234567890'
|
30
|
-
# ENV['YT_CLIENT_SECRET'] = 'ABCDEFGHIJ1234567890'
|
31
|
-
#
|
32
|
-
class Configuration
|
33
|
-
# @return [String] the Client ID for web/device YouTube applications.
|
34
|
-
# @see https://console.developers.google.com Google Developers Console
|
35
|
-
attr_accessor :client_id
|
36
|
-
|
37
|
-
# @return [String] the Client Secret for web/device YouTube applications.
|
38
|
-
# @see https://console.developers.google.com Google Developers Console
|
39
|
-
attr_accessor :client_secret
|
40
|
-
|
41
|
-
# @return [String] the API key for server/browser YouTube applications.
|
42
|
-
# @see https://console.developers.google.com Google Developers Console
|
43
|
-
attr_accessor :api_key
|
44
|
-
|
45
|
-
# @return [String] the level of output to print for debugging purposes.
|
46
|
-
attr_accessor :log_level
|
47
|
-
|
48
|
-
# Initialize the global configuration settings, using the values of
|
49
|
-
# the specified following environment variables by default.
|
50
|
-
def initialize
|
51
|
-
@client_id = ENV['YT_CLIENT_ID']
|
52
|
-
@client_secret = ENV['YT_CLIENT_SECRET']
|
53
|
-
@api_key = ENV['YT_API_KEY']
|
54
|
-
@log_level = ENV['YT_LOG_LEVEL']
|
55
|
-
end
|
56
|
-
|
57
|
-
# @return [Boolean] whether the logging output is extra-verbose.
|
58
|
-
# Useful when developing (e.g., to print the curl of every request).
|
59
|
-
def developing?
|
60
|
-
log_level.to_s.in? %w(devel)
|
61
|
-
end
|
62
|
-
|
63
|
-
# @return [Boolean] whether the logging output is verbose.
|
64
|
-
# Useful when debugging (e.g., to print the curl of failing requests).
|
65
|
-
def debugging?
|
66
|
-
log_level.to_s.in? %w(devel debug)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Yt::Configuration do
|
4
|
-
subject(:config) { Yt::Configuration.new }
|
5
|
-
|
6
|
-
describe '#client_id' do
|
7
|
-
context 'without an environment variable YT_CLIENT_ID' do
|
8
|
-
before { ENV['YT_CLIENT_ID'] = nil }
|
9
|
-
it {expect(config.client_id).to be_nil }
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'given an environment variable YT_CLIENT_ID' do
|
13
|
-
let(:client_id) { '1234567890.apps.googleusercontent.com' }
|
14
|
-
before { ENV['YT_CLIENT_ID'] = client_id}
|
15
|
-
it {expect(config.client_id).to eq client_id }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#client_secret' do
|
20
|
-
context 'without an environment variable YT_CLIENT_SECRET' do
|
21
|
-
before { ENV['YT_CLIENT_SECRET'] = nil }
|
22
|
-
it {expect(config.client_secret).to be_nil }
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'given an environment variable YT_CLIENT_SECRET' do
|
26
|
-
let(:client_secret) { '1234567890' }
|
27
|
-
before { ENV['YT_CLIENT_SECRET'] = client_secret}
|
28
|
-
it {expect(config.client_secret).to eq client_secret }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#api_key' do
|
33
|
-
context 'without an environment variable YT_API_KEY' do
|
34
|
-
before { ENV['YT_API_KEY'] = nil }
|
35
|
-
it {expect(config.api_key).to be_nil }
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'given an environment variable YT_API_KEY' do
|
39
|
-
let(:api_key) { '123456789012345678901234567890' }
|
40
|
-
before { ENV['YT_API_KEY'] = api_key}
|
41
|
-
it {expect(config.api_key).to eq api_key }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|