bootic_client 0.0.25 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bootic_client.gemspec +2 -4
- data/lib/bootic_client/client.rb +3 -1
- data/lib/bootic_client/configuration.rb +2 -0
- data/lib/bootic_client/entity.rb +3 -1
- data/lib/bootic_client/errors.rb +2 -0
- data/lib/bootic_client/relation.rb +2 -0
- data/lib/bootic_client/response_handlers.rb +4 -2
- data/lib/bootic_client/strategies/authorized.rb +2 -0
- data/lib/bootic_client/strategies/basic_auth.rb +2 -0
- 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 +11 -28
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 88fee920f8b9082a62647609e19ca3492a3eba9028c581ce6df09a2560335b34
|
4
|
+
data.tar.gz: 05b7c8e729b035f486252716392c74563ce0a0cb513a19a90b49309d135c8d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b205b02d5020df2a8dbb2d104a9b2110e2ae5fd39e48961214b85fc7ef562f81169d3b9021529324dd8d873a94fe58a9195a1113994a9d655d50f53a47ce421d
|
7
|
+
data.tar.gz: 193493b1e377c8db82e8adb6744186892d0ff6d02e31b3ed1dac1e21c9d4e18dea04dc155af082fc8064f5deb6d143e46ea4730fa6e6a7163bdbb51ba4230551
|
data/bootic_client.gemspec
CHANGED
@@ -14,17 +14,15 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ["lib"]
|
20
19
|
|
21
|
-
spec.add_dependency "faraday", '
|
20
|
+
spec.add_dependency "faraday", '>= 0.15'
|
22
21
|
spec.add_dependency "uri_template", '~> 0.7'
|
23
22
|
spec.add_dependency "faraday-http-cache", '~> 2'
|
24
|
-
spec.add_dependency "net-http-persistent", '~>
|
23
|
+
spec.add_dependency "net-http-persistent", '~> 4'
|
25
24
|
spec.add_dependency "oauth2", "~> 1.4"
|
26
25
|
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
28
26
|
spec.add_development_dependency "rake"
|
29
27
|
spec.add_development_dependency "rspec", "3.5.0"
|
30
28
|
spec.add_development_dependency "jwt", "~> 1.5"
|
data/lib/bootic_client/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'base64'
|
2
4
|
require 'faraday'
|
3
5
|
require 'faraday-http-cache'
|
@@ -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
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bootic_client/relation"
|
2
4
|
|
3
5
|
module BooticClient
|
@@ -72,7 +74,7 @@ module BooticClient
|
|
72
74
|
when Hash
|
73
75
|
new(obj, client, top: top)
|
74
76
|
when Array
|
75
|
-
obj.map{|e| wrap(e)}
|
77
|
+
obj.map{|e| wrap(e, client: client, top: top)}
|
76
78
|
else
|
77
79
|
obj
|
78
80
|
end
|
data/lib/bootic_client/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
|
3
5
|
module BooticClient
|
@@ -35,8 +37,8 @@ module BooticClient
|
|
35
37
|
IMAGE_MIME_EXP = /^image\//.freeze
|
36
38
|
CONTENT_TYPE = 'Content-Type'.freeze
|
37
39
|
IO = Struct.new(:io, :file_name, :mime_type) do
|
38
|
-
def read
|
39
|
-
io.read
|
40
|
+
def read(length = nil, outbuff = nil)
|
41
|
+
io.read(length, outbuff)
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -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,27 +1,27 @@
|
|
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.30
|
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: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.15'
|
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
26
|
version: '0.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '4'
|
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: '4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: oauth2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.3'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.3'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: rake
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,14 +139,12 @@ dependencies:
|
|
153
139
|
description: Official Ruby client for the Bootic API
|
154
140
|
email:
|
155
141
|
- ismaelct@gmail.com
|
156
|
-
executables:
|
157
|
-
- console
|
142
|
+
executables: []
|
158
143
|
extensions: []
|
159
144
|
extra_rdoc_files: []
|
160
145
|
files:
|
161
146
|
- ".gitignore"
|
162
147
|
- ".rspec"
|
163
|
-
- ".ruby-version"
|
164
148
|
- ".travis.yml"
|
165
149
|
- CHANGELOG.md
|
166
150
|
- Gemfile
|
@@ -205,7 +189,7 @@ homepage: https://developers.bootic.net
|
|
205
189
|
licenses:
|
206
190
|
- MIT
|
207
191
|
metadata: {}
|
208
|
-
post_install_message:
|
192
|
+
post_install_message:
|
209
193
|
rdoc_options: []
|
210
194
|
require_paths:
|
211
195
|
- lib
|
@@ -220,9 +204,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
204
|
- !ruby/object:Gem::Version
|
221
205
|
version: '0'
|
222
206
|
requirements: []
|
223
|
-
|
224
|
-
|
225
|
-
signing_key:
|
207
|
+
rubygems_version: 3.0.3
|
208
|
+
signing_key:
|
226
209
|
specification_version: 4
|
227
210
|
summary: Official Ruby client for the Bootic API
|
228
211
|
test_files:
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.3.1
|