yt-support 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/lib/yt/configuration.rb +6 -0
- data/lib/yt/http_error.rb +6 -0
- data/lib/yt/http_request.rb +17 -4
- data/lib/yt/support/version.rb +3 -2
- data/yt-support.gemspec +6 -4
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d82d16731736e5ee31d63657ab86ff1dd911607
|
4
|
+
data.tar.gz: f48f9376a410f3407cabb12d4763cd14f726be38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e1c590dc23269d3d22a41f57b212b6594ead53761a0470a6affd963dbf08fd8d5910d64ae184c668bb2d048e1acc138d9528cd4af90e38db93375b2d8925cf
|
7
|
+
data.tar.gz: 579ab329148261c0a0d59460eca0c3b16d799ffb7ce8c6a898a961786de0e356c9749b3580d4606b28c28ba16aeb1285425cd3c737114c9b4a742f815f9df362
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ 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.1.3 - 2017-06-02
|
10
|
+
|
11
|
+
* [FEATURE] Add `Yt.configuration.access_token` and `.refresh_token`
|
12
|
+
|
9
13
|
## 0.1.2 - 2017-04-02
|
10
14
|
|
11
15
|
* [FEATURE] Add Yt::ConnectionError to deal with connection/server errors
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017 Fullscreen, Inc.
|
3
|
+
Copyright (c) 2017-present Fullscreen, Inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/yt/configuration.rb
CHANGED
@@ -44,6 +44,12 @@ module Yt
|
|
44
44
|
# @return [String] the level of output to print for debugging purposes.
|
45
45
|
attr_accessor :log_level
|
46
46
|
|
47
|
+
# @return [String] the access token to act on behalf of a YouTube account.
|
48
|
+
attr_accessor :access_token
|
49
|
+
|
50
|
+
# @return [String] the token to refresh an expired access token.
|
51
|
+
attr_accessor :refresh_token
|
52
|
+
|
47
53
|
# Initialize the global configuration settings, using the values of
|
48
54
|
# the specified following environment variables by default.
|
49
55
|
def initialize
|
data/lib/yt/http_error.rb
CHANGED
data/lib/yt/http_request.rb
CHANGED
@@ -50,7 +50,7 @@ module Yt
|
|
50
50
|
parse_response!
|
51
51
|
end
|
52
52
|
else
|
53
|
-
raise Yt::HTTPError,
|
53
|
+
raise Yt::HTTPError.new(error_message, response: response)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -85,13 +85,25 @@ module Yt
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def as_curl
|
89
|
+
'curl'.tap do |curl|
|
90
|
+
curl << " -X #{http_request.method}"
|
91
|
+
http_request.each_header{|k, v| curl << %Q{ -H "#{k}: #{v}"}}
|
92
|
+
curl << %Q{ -d '#{http_request.body}'} if http_request.body
|
93
|
+
curl << %Q{ "#{uri.to_s}"}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
88
97
|
# Adds the request body to the request in the appropriate format.
|
89
98
|
# if the request body is a JSON Object, transform its keys into camel-case,
|
90
99
|
# since this is the common format for JSON APIs.
|
91
100
|
def set_request_body!(request)
|
92
|
-
|
93
|
-
|
94
|
-
|
101
|
+
case @request_format
|
102
|
+
when :json
|
103
|
+
request.body = @body.to_json
|
104
|
+
when :form
|
105
|
+
request.set_form_data @body
|
106
|
+
end if @body
|
95
107
|
end
|
96
108
|
|
97
109
|
# Adds the request headers to the request in the appropriate format.
|
@@ -110,6 +122,7 @@ module Yt
|
|
110
122
|
# Run the request and memoize the response or the server error received.
|
111
123
|
def response
|
112
124
|
@response ||= Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
125
|
+
puts as_curl if Yt.configuration.developing?
|
113
126
|
http.request http_request
|
114
127
|
end
|
115
128
|
rescue *server_errors => e
|
data/lib/yt/support/version.rb
CHANGED
data/yt-support.gemspec
CHANGED
@@ -17,15 +17,17 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.required_ruby_version = '>= 2.2.2'
|
19
19
|
|
20
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
22
|
+
end
|
21
23
|
spec.bindir = 'exe'
|
22
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
25
|
spec.require_paths = ['lib']
|
24
26
|
|
25
27
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
28
|
spec.add_development_dependency 'rspec', '~> 3.5'
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
28
|
-
spec.add_development_dependency 'coveralls', '~> 0.8.
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
30
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.20'
|
29
31
|
spec.add_development_dependency 'pry-nav', '~> 0.2.4'
|
30
|
-
spec.add_development_dependency 'yard', '~> 0.9.
|
32
|
+
spec.add_development_dependency 'yard', '~> 0.9.8'
|
31
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -45,28 +45,28 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '12.0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '12.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: coveralls
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.8.
|
62
|
+
version: 0.8.20
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.8.
|
69
|
+
version: 0.8.20
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: pry-nav
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.9.
|
90
|
+
version: 0.9.8
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.9.
|
97
|
+
version: 0.9.8
|
98
98
|
description: |-
|
99
99
|
Yt::Support provides common functionality to Yt,
|
100
100
|
Yt::Auth. It is considered suitable for internal use only at this time.
|