yt-support 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 320897c435303a2e12b6889a59b0258dd249b4ef
4
+ data.tar.gz: d96402625a05ab1e621d98b94a6e7810253a0a92
5
+ SHA512:
6
+ metadata.gz: a848182a029379a5c58640a1c7bdeae13f15fda93db35378ff1af40df4540bfa3089f089b09e9ae91dc6e2eb8422432b6376cd8ae76734f659984db36caa86c7
7
+ data.tar.gz: c47d0461dac76678f894ccb80d6a34f63af935f5206a12a35b23f90b850291bbf5e263af46e482287ba69f0a468a8448fa80c71ddb3aa78cef326dd536435b4a
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --fail-fast
@@ -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"
@@ -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-03-17
10
+
11
+ * [FEATURE] Extracted Yt::Config and Yt::Configuration from Yt
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in yt-support.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Fullscreen, Inc.
4
+
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
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.
@@ -0,0 +1,32 @@
1
+ Common code needed by the other Yt gems
2
+ =======================================
3
+
4
+ Yt::Support provides common functionality to all Yt gems.
5
+ It is considered suitable for internal use only at this time.
6
+
7
+ The **source code** is available on [GitHub](https://github.com/fullscreen/yt-support) and the **documentation** on [RubyDoc](http://www.rubydoc.info/gems/yt-support/frames).
8
+
9
+ [![Build Status](http://img.shields.io/travis/Fullscreen/yt-support/master.svg)](https://travis-ci.org/Fullscreen/yt-support)
10
+ [![Coverage Status](http://img.shields.io/coveralls/fullscreen/yt-support/master.svg)](https://coveralls.io/r/Fullscreen/yt-support)
11
+ [![Dependency Status](http://img.shields.io/gemnasium/fullscreen/yt-support.svg)](https://gemnasium.com/Fullscreen/yt-support)
12
+ [![Code Climate](http://img.shields.io/codeclimate/github/fullscreen/yt-support.svg)](https://codeclimate.com/github/Fullscreen/yt-support)
13
+ [![Online docs](http://img.shields.io/badge/docs-✓-green.svg)](http://www.rubydoc.info/gems/yt-support/frames)
14
+ [![Gem Version](http://img.shields.io/gem/v/yt-support.svg)](http://rubygems.org/gems/yt-support)
15
+
16
+ Yt::Support provides:
17
+
18
+ * [Yt.configure](http://www.rubydoc.info/gems/yt-support/Yt/Config#configure-instance_method)
19
+ * [Yt::Configuration](http://www.rubydoc.info/gems/yt-support/Yt/Configuration)
20
+
21
+ How to contribute
22
+ =================
23
+
24
+ Contribute to the code by forking the project, adding the missing code,
25
+ writing the appropriate tests and submitting a pull request.
26
+
27
+ In order for a PR to be approved, all the tests need to pass and all the public
28
+ methods need to be documented and listed in the guides. Remember:
29
+
30
+ - to run all tests locally: `bundle exec rspec`
31
+ - to generate the docs locally: `bundle exec yard`
32
+ - to list undocumented methods: `bundle exec yard stats --list-undoc`
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
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]
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "yt/support"
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(__FILE__)
@@ -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
@@ -0,0 +1,55 @@
1
+ require 'yt/configuration'
2
+
3
+ # An object-oriented Ruby client for YouTube.
4
+ # @see http://www.rubydoc.info/gems/yt/
5
+ module Yt
6
+ # Provides methods to read and write global configuration settings.
7
+ #
8
+ # A typical usage is to set the API keys retrieved from the
9
+ # {http://console.developers.google.com Google Developers Console}.
10
+ #
11
+ # @example Set the API key for a server-only YouTube app:
12
+ # Yt.configure do |config|
13
+ # config.api_key = 'ABCDEFGHIJ1234567890'
14
+ # end
15
+ #
16
+ # @example Set the API client id/secret for a web-client YouTube app:
17
+ # Yt.configure do |config|
18
+ # config.client_id = 'ABCDEFGHIJ1234567890'
19
+ # config.client_secret = 'ABCDEFGHIJ1234567890'
20
+ # end
21
+ #
22
+ # Note that Yt.configure has precedence over values through with
23
+ # environment variables (see {Yt::Models::Configuration}).
24
+ #
25
+ module Config
26
+ # Yields the global configuration to the given block.
27
+ #
28
+ # @example
29
+ # Yt.configure do |config|
30
+ # config.api_key = 'ABCDEFGHIJ1234567890'
31
+ # end
32
+ #
33
+ # @yield [Yt::Models::Configuration] The global configuration.
34
+ def configure
35
+ yield configuration if block_given?
36
+ end
37
+
38
+ # Returns the global {Yt::Models::Configuration} object.
39
+ #
40
+ # While this method _can_ be used to read and write configuration settings,
41
+ # it is easier to use {Yt::Config#configure} Yt.configure}.
42
+ #
43
+ # @example
44
+ # Yt.configuration.api_key = 'ABCDEFGHIJ1234567890'
45
+ #
46
+ # @return [Yt::Models::Configuration] The global configuration.
47
+ def configuration
48
+ @configuration ||= Yt::Configuration.new
49
+ end
50
+ end
51
+
52
+ # @note Config is the only module auto-loaded in the Yt module,
53
+ # in order to have a syntax as easy as Yt.configure
54
+ extend Config
55
+ end
@@ -0,0 +1,68 @@
1
+ module Yt
2
+ # Provides an object to store global configuration settings.
3
+ #
4
+ # This class is typically not used directly, but by calling
5
+ # {Yt::Config#configure Yt.configure}, which creates and updates a single
6
+ # instance of {Yt::Models::Configuration}.
7
+ #
8
+ # @example Set the API client id/secret for a web-client YouTube app:
9
+ # Yt.configure do |config|
10
+ # config.client_id = 'ABCDEFGHIJ1234567890'
11
+ # config.client_secret = 'ABCDEFGHIJ1234567890'
12
+ # end
13
+ #
14
+ # @see Yt::Config for more examples.
15
+ #
16
+ # An alternative way to set global configuration settings is by storing
17
+ # them in the following environment variables:
18
+ #
19
+ # * +YT_CLIENT_ID+ to store the Client ID for web/device apps
20
+ # * +YT_CLIENT_SECRET+ to store the Client Secret for web/device apps
21
+ # * +YT_API_KEY+ to store the API key for server/browser apps
22
+ # * +YT_LOG_LEVEL+ to store the verbosity level of the logs
23
+ #
24
+ # In case both methods are used together,
25
+ # {Yt::Config#configure Yt.configure} takes precedence.
26
+ #
27
+ # @example Set the API client id/secret for a web-client YouTube app:
28
+ # ENV['YT_CLIENT_ID'] = 'ABCDEFGHIJ1234567890'
29
+ # ENV['YT_CLIENT_SECRET'] = 'ABCDEFGHIJ1234567890'
30
+ #
31
+ class Configuration
32
+ # @return [String] the Client ID for web/device YouTube applications.
33
+ # @see https://console.developers.google.com Google Developers Console
34
+ attr_accessor :client_id
35
+
36
+ # @return [String] the Client Secret for web/device YouTube applications.
37
+ # @see https://console.developers.google.com Google Developers Console
38
+ attr_accessor :client_secret
39
+
40
+ # @return [String] the API key for server/browser YouTube applications.
41
+ # @see https://console.developers.google.com Google Developers Console
42
+ attr_accessor :api_key
43
+
44
+ # @return [String] the level of output to print for debugging purposes.
45
+ attr_accessor :log_level
46
+
47
+ # Initialize the global configuration settings, using the values of
48
+ # the specified following environment variables by default.
49
+ def initialize
50
+ @client_id = ENV['YT_CLIENT_ID']
51
+ @client_secret = ENV['YT_CLIENT_SECRET']
52
+ @api_key = ENV['YT_API_KEY']
53
+ @log_level = ENV['YT_LOG_LEVEL']
54
+ end
55
+
56
+ # @return [Boolean] whether the logging output is extra-verbose.
57
+ # Useful when developing (e.g., to print the curl of every request).
58
+ def developing?
59
+ %w(devel).include? log_level.to_s
60
+ end
61
+
62
+ # @return [Boolean] whether the logging output is verbose.
63
+ # Useful when debugging (e.g., to print the curl of failing requests).
64
+ def debugging?
65
+ %w(devel debug).include? log_level.to_s
66
+ end
67
+ end
68
+ end
@@ -0,0 +1 @@
1
+ require 'yt/config'
@@ -0,0 +1,7 @@
1
+ module Yt
2
+ # Provides common functionality to all Yt gems.
3
+ module Support
4
+ # current version of gem
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'yt/support/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'yt-support'
8
+ spec.version = Yt::Support::VERSION
9
+ spec.authors = ['Claudio Baccigalupo', 'Kang-Kyu Lee']
10
+ spec.email = ['claudio@fullscreen.net', 'kang-kyu.lee@fullscreen.net']
11
+
12
+ spec.summary = %q{Support utilities for Yt gems}
13
+ spec.description = %q{Yt::Support provides common functionality to Yt,
14
+ Yt::Auth. It is considered suitable for internal use only at this time.}
15
+ spec.homepage = 'https://github.com/fullscreen/yt-support'
16
+ spec.license = 'MIT'
17
+
18
+ spec.required_ruby_version = '>= 2.2.2'
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.14'
26
+ spec.add_development_dependency 'rspec', '~> 3.5'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'coveralls', '~> 0.8.15'
29
+ spec.add_development_dependency 'pry-nav', '~> 0.2.4'
30
+ spec.add_development_dependency 'yard', '~> 0.9.5'
31
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yt-support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Claudio Baccigalupo
8
+ - Kang-Kyu Lee
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2017-03-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.14'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.14'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '3.5'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.5'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: coveralls
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.8.15
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.8.15
70
+ - !ruby/object:Gem::Dependency
71
+ name: pry-nav
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.2.4
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 0.2.4
84
+ - !ruby/object:Gem::Dependency
85
+ name: yard
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 0.9.5
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.9.5
98
+ description: |-
99
+ Yt::Support provides common functionality to Yt,
100
+ Yt::Auth. It is considered suitable for internal use only at this time.
101
+ email:
102
+ - claudio@fullscreen.net
103
+ - kang-kyu.lee@fullscreen.net
104
+ executables: []
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - ".gitignore"
109
+ - ".rspec"
110
+ - ".travis.yml"
111
+ - CHANGELOG.md
112
+ - Gemfile
113
+ - LICENSE.txt
114
+ - README.md
115
+ - Rakefile
116
+ - bin/console
117
+ - bin/setup
118
+ - lib/yt/config.rb
119
+ - lib/yt/configuration.rb
120
+ - lib/yt/support.rb
121
+ - lib/yt/support/version.rb
122
+ - yt-support.gemspec
123
+ homepage: https://github.com/fullscreen/yt-support
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: 2.2.2
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.11
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Support utilities for Yt gems
147
+ test_files: []