oauth2 1.4.7 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +114 -22
- data/CONTRIBUTING.md +18 -0
- data/LICENSE +1 -1
- data/README.md +383 -138
- data/SECURITY.md +20 -0
- data/lib/oauth2/access_token.rb +32 -21
- data/lib/oauth2/authenticator.rb +12 -5
- data/lib/oauth2/client.rb +142 -81
- data/lib/oauth2/error.rb +29 -18
- data/lib/oauth2/response.rb +63 -19
- data/lib/oauth2/snaky_hash.rb +8 -0
- data/lib/oauth2/strategy/assertion.rb +66 -39
- data/lib/oauth2/strategy/auth_code.rb +15 -2
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +3 -1
- data/lib/oauth2/strategy/implicit.rb +10 -1
- data/lib/oauth2/strategy/password.rb +3 -1
- data/lib/oauth2/version.rb +1 -59
- data/lib/oauth2.rb +21 -1
- metadata +75 -97
- data/lib/oauth2/mac_token.rb +0 -130
- data/spec/helper.rb +0 -37
- data/spec/oauth2/access_token_spec.rb +0 -216
- data/spec/oauth2/authenticator_spec.rb +0 -84
- data/spec/oauth2/client_spec.rb +0 -506
- data/spec/oauth2/mac_token_spec.rb +0 -117
- data/spec/oauth2/response_spec.rb +0 -90
- data/spec/oauth2/strategy/assertion_spec.rb +0 -58
- data/spec/oauth2/strategy/auth_code_spec.rb +0 -107
- data/spec/oauth2/strategy/base_spec.rb +0 -5
- data/spec/oauth2/strategy/client_credentials_spec.rb +0 -69
- data/spec/oauth2/strategy/implicit_spec.rb +0 -26
- data/spec/oauth2/strategy/password_spec.rb +0 -55
- data/spec/oauth2/version_spec.rb +0 -23
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
8
|
-
- Michael Bleigh
|
9
8
|
- Erik Michaels-Ober
|
10
|
-
|
9
|
+
- Michael Bleigh
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-06-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -18,20 +18,20 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.17.3
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '3.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
31
|
+
version: 0.17.3
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '3.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: jwt
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,157 +53,157 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: multi_xml
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0.5'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.2'
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '3'
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
|
-
- - "
|
83
|
+
- - ">="
|
81
84
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
85
|
+
version: '1.2'
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: rash_alt
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
93
|
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
95
|
+
version: '0.4'
|
90
96
|
- - "<"
|
91
97
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
98
|
+
version: '1'
|
93
99
|
type: :runtime
|
94
100
|
prerelease: false
|
95
101
|
version_requirements: !ruby/object:Gem::Requirement
|
96
102
|
requirements:
|
97
103
|
- - ">="
|
98
104
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
105
|
+
version: '0.4'
|
100
106
|
- - "<"
|
101
107
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
108
|
+
version: '1'
|
103
109
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
110
|
+
name: version_gem
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
106
112
|
requirements:
|
107
113
|
- - "~>"
|
108
114
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
110
|
-
type: :
|
115
|
+
version: '1.0'
|
116
|
+
type: :runtime
|
111
117
|
prerelease: false
|
112
118
|
version_requirements: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
120
|
- - "~>"
|
115
121
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
122
|
+
version: '1.0'
|
117
123
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
124
|
+
name: addressable
|
119
125
|
requirement: !ruby/object:Gem::Requirement
|
120
126
|
requirements:
|
121
|
-
- - "
|
127
|
+
- - ">="
|
122
128
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
129
|
+
version: '2'
|
124
130
|
type: :development
|
125
131
|
prerelease: false
|
126
132
|
version_requirements: !ruby/object:Gem::Requirement
|
127
133
|
requirements:
|
128
|
-
- - "
|
134
|
+
- - ">="
|
129
135
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
136
|
+
version: '2'
|
131
137
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
138
|
+
name: backports
|
133
139
|
requirement: !ruby/object:Gem::Requirement
|
134
140
|
requirements:
|
135
141
|
- - ">="
|
136
142
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
143
|
+
version: '3'
|
138
144
|
type: :development
|
139
145
|
prerelease: false
|
140
146
|
version_requirements: !ruby/object:Gem::Requirement
|
141
147
|
requirements:
|
142
148
|
- - ">="
|
143
149
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
150
|
+
version: '3'
|
145
151
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
152
|
+
name: bundler
|
147
153
|
requirement: !ruby/object:Gem::Requirement
|
148
154
|
requirements:
|
149
|
-
- - "
|
155
|
+
- - ">="
|
150
156
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
157
|
+
version: '2'
|
152
158
|
type: :development
|
153
159
|
prerelease: false
|
154
160
|
version_requirements: !ruby/object:Gem::Requirement
|
155
161
|
requirements:
|
156
|
-
- - "
|
162
|
+
- - ">="
|
157
163
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
164
|
+
version: '2'
|
159
165
|
- !ruby/object:Gem::Dependency
|
160
166
|
name: rake
|
161
167
|
requirement: !ruby/object:Gem::Requirement
|
162
168
|
requirements:
|
163
|
-
- - "
|
169
|
+
- - ">="
|
164
170
|
- !ruby/object:Gem::Version
|
165
|
-
version: '12
|
171
|
+
version: '12'
|
166
172
|
type: :development
|
167
173
|
prerelease: false
|
168
174
|
version_requirements: !ruby/object:Gem::Requirement
|
169
175
|
requirements:
|
170
|
-
- - "
|
176
|
+
- - ">="
|
171
177
|
- !ruby/object:Gem::Version
|
172
|
-
version: '12
|
178
|
+
version: '12'
|
173
179
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
180
|
+
name: rexml
|
175
181
|
requirement: !ruby/object:Gem::Requirement
|
176
182
|
requirements:
|
177
183
|
- - ">="
|
178
184
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
180
|
-
- - "<"
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: '7'
|
185
|
+
version: '3'
|
183
186
|
type: :development
|
184
187
|
prerelease: false
|
185
188
|
version_requirements: !ruby/object:Gem::Requirement
|
186
189
|
requirements:
|
187
190
|
- - ">="
|
188
191
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
190
|
-
- - "<"
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
version: '7'
|
192
|
+
version: '3'
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: rspec
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
|
-
- - "
|
197
|
+
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: '3
|
199
|
+
version: '3'
|
200
200
|
type: :development
|
201
201
|
prerelease: false
|
202
202
|
version_requirements: !ruby/object:Gem::Requirement
|
203
203
|
requirements:
|
204
|
-
- - "
|
204
|
+
- - ">="
|
205
205
|
- !ruby/object:Gem::Version
|
206
|
-
version: '3
|
206
|
+
version: '3'
|
207
207
|
- !ruby/object:Gem::Dependency
|
208
208
|
name: rspec-block_is_expected
|
209
209
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,21 +247,21 @@ dependencies:
|
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
- !ruby/object:Gem::Dependency
|
250
|
-
name:
|
250
|
+
name: rubocop-lts
|
251
251
|
requirement: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
|
-
- - "
|
253
|
+
- - "~>"
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version: '0'
|
255
|
+
version: '8.0'
|
256
256
|
type: :development
|
257
257
|
prerelease: false
|
258
258
|
version_requirements: !ruby/object:Gem::Requirement
|
259
259
|
requirements:
|
260
|
-
- - "
|
260
|
+
- - "~>"
|
261
261
|
- !ruby/object:Gem::Version
|
262
|
-
version: '0'
|
262
|
+
version: '8.0'
|
263
263
|
- !ruby/object:Gem::Dependency
|
264
|
-
name:
|
264
|
+
name: silent_stream
|
265
265
|
requirement: !ruby/object:Gem::Requirement
|
266
266
|
requirements:
|
267
267
|
- - ">="
|
@@ -284,15 +284,17 @@ extra_rdoc_files: []
|
|
284
284
|
files:
|
285
285
|
- CHANGELOG.md
|
286
286
|
- CODE_OF_CONDUCT.md
|
287
|
+
- CONTRIBUTING.md
|
287
288
|
- LICENSE
|
288
289
|
- README.md
|
290
|
+
- SECURITY.md
|
289
291
|
- lib/oauth2.rb
|
290
292
|
- lib/oauth2/access_token.rb
|
291
293
|
- lib/oauth2/authenticator.rb
|
292
294
|
- lib/oauth2/client.rb
|
293
295
|
- lib/oauth2/error.rb
|
294
|
-
- lib/oauth2/mac_token.rb
|
295
296
|
- lib/oauth2/response.rb
|
297
|
+
- lib/oauth2/snaky_hash.rb
|
296
298
|
- lib/oauth2/strategy/assertion.rb
|
297
299
|
- lib/oauth2/strategy/auth_code.rb
|
298
300
|
- lib/oauth2/strategy/base.rb
|
@@ -300,29 +302,18 @@ files:
|
|
300
302
|
- lib/oauth2/strategy/implicit.rb
|
301
303
|
- lib/oauth2/strategy/password.rb
|
302
304
|
- lib/oauth2/version.rb
|
303
|
-
- spec/helper.rb
|
304
|
-
- spec/oauth2/access_token_spec.rb
|
305
|
-
- spec/oauth2/authenticator_spec.rb
|
306
|
-
- spec/oauth2/client_spec.rb
|
307
|
-
- spec/oauth2/mac_token_spec.rb
|
308
|
-
- spec/oauth2/response_spec.rb
|
309
|
-
- spec/oauth2/strategy/assertion_spec.rb
|
310
|
-
- spec/oauth2/strategy/auth_code_spec.rb
|
311
|
-
- spec/oauth2/strategy/base_spec.rb
|
312
|
-
- spec/oauth2/strategy/client_credentials_spec.rb
|
313
|
-
- spec/oauth2/strategy/implicit_spec.rb
|
314
|
-
- spec/oauth2/strategy/password_spec.rb
|
315
|
-
- spec/oauth2/version_spec.rb
|
316
305
|
homepage: https://github.com/oauth-xx/oauth2
|
317
306
|
licenses:
|
318
307
|
- MIT
|
319
308
|
metadata:
|
309
|
+
homepage_uri: https://github.com/oauth-xx/oauth2
|
310
|
+
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v2.0.2
|
311
|
+
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v2.0.2/CHANGELOG.md
|
320
312
|
bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
|
321
|
-
|
322
|
-
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.7
|
323
|
-
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.7
|
313
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.2
|
324
314
|
wiki_uri: https://github.com/oauth-xx/oauth2/wiki
|
325
|
-
|
315
|
+
rubygems_mfa_required: 'true'
|
316
|
+
post_install_message:
|
326
317
|
rdoc_options: []
|
327
318
|
require_paths:
|
328
319
|
- lib
|
@@ -330,28 +321,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
321
|
requirements:
|
331
322
|
- - ">="
|
332
323
|
- !ruby/object:Gem::Version
|
333
|
-
version:
|
324
|
+
version: 2.2.0
|
334
325
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
326
|
requirements:
|
336
327
|
- - ">="
|
337
328
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
329
|
+
version: '0'
|
339
330
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
341
|
-
signing_key:
|
331
|
+
rubygems_version: 3.3.16
|
332
|
+
signing_key:
|
342
333
|
specification_version: 4
|
343
334
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|
344
|
-
test_files:
|
345
|
-
- spec/helper.rb
|
346
|
-
- spec/oauth2/client_spec.rb
|
347
|
-
- spec/oauth2/version_spec.rb
|
348
|
-
- spec/oauth2/authenticator_spec.rb
|
349
|
-
- spec/oauth2/mac_token_spec.rb
|
350
|
-
- spec/oauth2/access_token_spec.rb
|
351
|
-
- spec/oauth2/response_spec.rb
|
352
|
-
- spec/oauth2/strategy/password_spec.rb
|
353
|
-
- spec/oauth2/strategy/client_credentials_spec.rb
|
354
|
-
- spec/oauth2/strategy/assertion_spec.rb
|
355
|
-
- spec/oauth2/strategy/implicit_spec.rb
|
356
|
-
- spec/oauth2/strategy/auth_code_spec.rb
|
357
|
-
- spec/oauth2/strategy/base_spec.rb
|
335
|
+
test_files: []
|
data/lib/oauth2/mac_token.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require 'digest'
|
3
|
-
require 'openssl'
|
4
|
-
require 'securerandom'
|
5
|
-
|
6
|
-
module OAuth2
|
7
|
-
class MACToken < AccessToken
|
8
|
-
# Generates a MACToken from an AccessToken and secret
|
9
|
-
#
|
10
|
-
# @param [AccessToken] token the OAuth2::Token instance
|
11
|
-
# @option [String] secret the secret key value
|
12
|
-
# @param [Hash] opts the options to create the Access Token with
|
13
|
-
# @see MACToken#initialize
|
14
|
-
def self.from_access_token(token, secret, options = {})
|
15
|
-
new(token.client, token.token, secret, token.params.merge(:refresh_token => token.refresh_token, :expires_in => token.expires_in, :expires_at => token.expires_at).merge(options))
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :secret, :algorithm
|
19
|
-
|
20
|
-
# Initalize a MACToken
|
21
|
-
#
|
22
|
-
# @param [Client] client the OAuth2::Client instance
|
23
|
-
# @param [String] token the Access Token value
|
24
|
-
# @option [String] secret the secret key value
|
25
|
-
# @param [Hash] opts the options to create the Access Token with
|
26
|
-
# @option opts [String] :refresh_token (nil) the refresh_token value
|
27
|
-
# @option opts [FixNum, String] :expires_in (nil) the number of seconds in which the AccessToken will expire
|
28
|
-
# @option opts [FixNum, String] :expires_at (nil) the epoch time in seconds in which AccessToken will expire
|
29
|
-
# @option opts [FixNum, String] :algorithm (hmac-sha-256) the algorithm to use for the HMAC digest (one of 'hmac-sha-256', 'hmac-sha-1')
|
30
|
-
def initialize(client, token, secret, opts = {})
|
31
|
-
@secret = secret
|
32
|
-
self.algorithm = opts.delete(:algorithm) || 'hmac-sha-256'
|
33
|
-
|
34
|
-
super(client, token, opts)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Make a request with the MAC Token
|
38
|
-
#
|
39
|
-
# @param [Symbol] verb the HTTP request method
|
40
|
-
# @param [String] path the HTTP URL path of the request
|
41
|
-
# @param [Hash] opts the options to make the request with
|
42
|
-
# @see Client#request
|
43
|
-
def request(verb, path, opts = {}, &block)
|
44
|
-
url = client.connection.build_url(path, opts[:params]).to_s
|
45
|
-
|
46
|
-
opts[:headers] ||= {}
|
47
|
-
opts[:headers]['Authorization'] = header(verb, url)
|
48
|
-
|
49
|
-
@client.request(verb, path, opts, &block)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Get the headers hash (always an empty hash)
|
53
|
-
def headers
|
54
|
-
{}
|
55
|
-
end
|
56
|
-
|
57
|
-
# Generate the MAC header
|
58
|
-
#
|
59
|
-
# @param [Symbol] verb the HTTP request method
|
60
|
-
# @param [String] url the HTTP URL path of the request
|
61
|
-
def header(verb, url)
|
62
|
-
timestamp = Time.now.utc.to_i
|
63
|
-
nonce = Digest::MD5.hexdigest([timestamp, SecureRandom.hex].join(':'))
|
64
|
-
|
65
|
-
uri = URI.parse(url)
|
66
|
-
|
67
|
-
raise(ArgumentError, "could not parse \"#{url}\" into URI") unless uri.is_a?(URI::HTTP)
|
68
|
-
|
69
|
-
mac = signature(timestamp, nonce, verb, uri)
|
70
|
-
|
71
|
-
"MAC id=\"#{token}\", ts=\"#{timestamp}\", nonce=\"#{nonce}\", mac=\"#{mac}\""
|
72
|
-
end
|
73
|
-
|
74
|
-
# Generate the Base64-encoded HMAC digest signature
|
75
|
-
#
|
76
|
-
# @param [Fixnum] timestamp the timestamp of the request in seconds since epoch
|
77
|
-
# @param [String] nonce the MAC header nonce
|
78
|
-
# @param [Symbol] verb the HTTP request method
|
79
|
-
# @param [String] url the HTTP URL path of the request
|
80
|
-
def signature(timestamp, nonce, verb, uri)
|
81
|
-
signature = [
|
82
|
-
timestamp,
|
83
|
-
nonce,
|
84
|
-
verb.to_s.upcase,
|
85
|
-
uri.request_uri,
|
86
|
-
uri.host,
|
87
|
-
uri.port,
|
88
|
-
'', nil
|
89
|
-
].join("\n")
|
90
|
-
|
91
|
-
strict_encode64(OpenSSL::HMAC.digest(@algorithm, secret, signature))
|
92
|
-
end
|
93
|
-
|
94
|
-
# Set the HMAC algorithm
|
95
|
-
#
|
96
|
-
# @param [String] alg the algorithm to use (one of 'hmac-sha-1', 'hmac-sha-256')
|
97
|
-
def algorithm=(alg)
|
98
|
-
@algorithm = begin
|
99
|
-
case alg.to_s
|
100
|
-
when 'hmac-sha-1'
|
101
|
-
begin
|
102
|
-
OpenSSL::Digest('SHA1').new
|
103
|
-
rescue StandardError
|
104
|
-
OpenSSL::Digest.new('SHA1')
|
105
|
-
end
|
106
|
-
when 'hmac-sha-256'
|
107
|
-
begin
|
108
|
-
OpenSSL::Digest('SHA256').new
|
109
|
-
rescue StandardError
|
110
|
-
OpenSSL::Digest.new('SHA256')
|
111
|
-
end
|
112
|
-
else
|
113
|
-
raise(ArgumentError, 'Unsupported algorithm')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
private
|
119
|
-
|
120
|
-
# No-op since we need the verb and path
|
121
|
-
# and the MAC always goes in a header
|
122
|
-
def token=(_noop)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Base64.strict_encode64 is not available on Ruby 1.8.7
|
126
|
-
def strict_encode64(str)
|
127
|
-
Base64.encode64(str).delete("\n")
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
data/spec/helper.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
DEBUG = ENV['DEBUG'] == 'true'
|
2
|
-
|
3
|
-
ruby_version = Gem::Version.new(RUBY_VERSION)
|
4
|
-
|
5
|
-
if ruby_version >= Gem::Version.new('2.7')
|
6
|
-
require 'simplecov'
|
7
|
-
require 'coveralls'
|
8
|
-
|
9
|
-
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
10
|
-
|
11
|
-
SimpleCov.start do
|
12
|
-
add_filter '/spec'
|
13
|
-
minimum_coverage(95)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
require 'byebug' if DEBUG && ruby_version >= Gem::Version.new('2.4')
|
18
|
-
|
19
|
-
require 'oauth2'
|
20
|
-
require 'addressable/uri'
|
21
|
-
require 'rspec'
|
22
|
-
require 'rspec/stubbed_env'
|
23
|
-
require 'silent_stream'
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
config.expect_with :rspec do |c|
|
27
|
-
c.syntax = :expect
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Faraday.default_adapter = :test
|
32
|
-
|
33
|
-
RSpec.configure do |conf|
|
34
|
-
conf.include SilentStream
|
35
|
-
end
|
36
|
-
|
37
|
-
VERBS = [:get, :post, :put, :delete].freeze
|