bootic_client 0.0.28 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bootic_client.gemspec +3 -3
- data/lib/bootic_client/client.rb +4 -2
- data/lib/bootic_client/configuration.rb +2 -0
- data/lib/bootic_client/entity.rb +2 -0
- data/lib/bootic_client/errors.rb +2 -0
- data/lib/bootic_client/relation.rb +2 -0
- data/lib/bootic_client/response_handlers.rb +2 -0
- data/lib/bootic_client/strategies/authorized.rb +2 -0
- data/lib/bootic_client/strategies/basic_auth.rb +3 -1
- data/lib/bootic_client/strategies/bearer.rb +2 -0
- data/lib/bootic_client/strategies/client_credentials.rb +2 -0
- data/lib/bootic_client/strategies/oauth2_strategy.rb +2 -0
- data/lib/bootic_client/strategies/strategy.rb +2 -0
- data/lib/bootic_client/version.rb +3 -1
- data/lib/bootic_client/whiny_uri.rb +3 -1
- data/spec/authorized_strategy_spec.rb +5 -4
- metadata +24 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8906bbfeddb298199ecb675eea93c3780da4a370633bd73cb633bc10f893ae5
|
4
|
+
data.tar.gz: d0de74be08f4fffb7f68e02354dead206c67ee1db0662506668fe18ee0ebc4d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caa8411fdb9ab778b1e30c0c9c2e39ee0847a7d8a652658314d058d273b52c653ca85fc444aed5894d4406455965a32202c52365ac7a32ba085d54280360e4df
|
7
|
+
data.tar.gz: 1f4989cf0177a73128c9861cedc41a047a986c1ec70394311168b354e312da768d2f2530364c63748e0ed431e9f9b3642321c73e34266c3150500cdf5ae8c53a
|
data/bootic_client.gemspec
CHANGED
@@ -17,13 +17,13 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "faraday", '~>
|
20
|
+
spec.add_dependency "faraday", '~> 2.2'
|
21
|
+
spec.add_dependency 'faraday-net_http_persistent', '~> 2.0'
|
21
22
|
spec.add_dependency "uri_template", '~> 0.7'
|
22
23
|
spec.add_dependency "faraday-http-cache", '~> 2'
|
23
|
-
spec.add_dependency "net-http-persistent", '~>
|
24
|
+
spec.add_dependency "net-http-persistent", '~> 4'
|
24
25
|
spec.add_dependency "oauth2", "~> 1.4"
|
25
26
|
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
27
27
|
spec.add_development_dependency "rake"
|
28
28
|
spec.add_development_dependency "rspec", "3.5.0"
|
29
29
|
spec.add_development_dependency "jwt", "~> 1.5"
|
data/lib/bootic_client/client.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'base64'
|
2
4
|
require 'faraday'
|
3
5
|
require 'faraday-http-cache'
|
4
6
|
require "bootic_client/errors"
|
5
|
-
require 'faraday/
|
7
|
+
require 'faraday/net_http_persistent'
|
6
8
|
|
7
9
|
module BooticClient
|
8
10
|
|
@@ -84,7 +86,7 @@ module BooticClient
|
|
84
86
|
cache_options = {serializer: SafeCacheSerializer, shared_cache: false, store: options[:cache_store]}
|
85
87
|
cache_options[:logger] = options[:logger] if options[:logging]
|
86
88
|
|
87
|
-
f.use :http_cache, cache_options
|
89
|
+
f.use :http_cache, **cache_options
|
88
90
|
f.response :logger, options[:logger] if options[:logging]
|
89
91
|
yield f if block_given?
|
90
92
|
f.adapter *Array(options[:faraday_adapter])
|
data/lib/bootic_client/entity.rb
CHANGED
data/lib/bootic_client/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bootic_client/strategies/strategy'
|
2
4
|
|
3
5
|
module BooticClient
|
@@ -17,7 +19,7 @@ module BooticClient
|
|
17
19
|
|
18
20
|
def client
|
19
21
|
@client ||= Client.new(options) do |c|
|
20
|
-
c.request :
|
22
|
+
c.request :authorization, :basic, options[:username], options[:password]
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri_template'
|
2
4
|
|
3
5
|
module BooticClient
|
@@ -35,7 +37,7 @@ module BooticClient
|
|
35
37
|
def path_variables
|
36
38
|
@path_variables ||= (
|
37
39
|
variables.find_all{ |v|
|
38
|
-
|
40
|
+
!!(href["{#{v}}"]) || !!(href["{/#{v}}"])
|
39
41
|
}
|
40
42
|
)
|
41
43
|
end
|
@@ -23,7 +23,7 @@ describe 'BooticClient::Strategies::Authorized' do
|
|
23
23
|
to_return(status: status, :headers => response_headers, :body => JSON.dump(body))
|
24
24
|
end
|
25
25
|
|
26
|
-
def stub_auth(expired_token, status, body
|
26
|
+
def stub_auth(expired_token, status, body = {})
|
27
27
|
now = Time.now
|
28
28
|
allow(Time).to receive(:now).and_return now
|
29
29
|
|
@@ -31,10 +31,10 @@ describe 'BooticClient::Strategies::Authorized' do
|
|
31
31
|
with(body: {
|
32
32
|
"assertion" => jwt_assertion(expired_token, now),
|
33
33
|
"assertion_type" => "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
34
|
-
"client_id" => client_id,
|
35
|
-
"client_secret" =>
|
34
|
+
"client_id" => '', # JWT assertion flow does not need client_id or secret, but library sends them empty
|
35
|
+
"client_secret" => '',
|
36
36
|
"grant_type" => "assertion",
|
37
|
-
"scope"=>
|
37
|
+
"scope" => ''
|
38
38
|
},
|
39
39
|
headers: {
|
40
40
|
'Content-Type'=>'application/x-www-form-urlencoded'
|
@@ -114,6 +114,7 @@ describe 'BooticClient::Strategies::Authorized' do
|
|
114
114
|
root = client.root
|
115
115
|
expect(@failed_root_request).to have_been_requested
|
116
116
|
expect(@auth_request).to have_been_requested
|
117
|
+
expect(@successful_root_request).to have_been_requested
|
117
118
|
expect(root.message).to eql('Hello!')
|
118
119
|
end
|
119
120
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootic_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,84 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday-net_http_persistent
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: uri_template
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0.7'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday-http-cache
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2'
|
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: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: net-http-persistent
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: oauth2
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
90
|
-
type: :
|
89
|
+
version: '1.4'
|
90
|
+
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,7 +203,7 @@ homepage: https://developers.bootic.net
|
|
203
203
|
licenses:
|
204
204
|
- MIT
|
205
205
|
metadata: {}
|
206
|
-
post_install_message:
|
206
|
+
post_install_message:
|
207
207
|
rdoc_options: []
|
208
208
|
require_paths:
|
209
209
|
- lib
|
@@ -218,9 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
|
-
|
222
|
-
|
223
|
-
signing_key:
|
221
|
+
rubygems_version: 3.2.32
|
222
|
+
signing_key:
|
224
223
|
specification_version: 4
|
225
224
|
summary: Official Ruby client for the Bootic API
|
226
225
|
test_files:
|