unimatrix 3.3.1 → 3.3.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/unimatrix/authorization/operation.rb +20 -8
- data/lib/unimatrix/authorization/request.rb +9 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e4a9781565879afc0c5d8edf0efdc4291a772bc
|
4
|
+
data.tar.gz: 2c8bfda82d8c2438d8dc8368eebbdff6fada85a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e017c0e73f8b915f4add49d20e4597ea1e350c9410561f497c798a8794ecb58ecd311689174f50ca25e27bae36470238e67c31a91016265cf76b46c44acd760
|
7
|
+
data.tar.gz: c4afdc30cc2b46c36668cbfeb169215d37a9994a4631a61d29bc39cd7f513252e38faaa101d055f3a68ddace1fd2263459132ccdbf7457910e51115abe5e7577
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.2
|
@@ -5,7 +5,9 @@ module Unimatrix::Authorization
|
|
5
5
|
result = nil
|
6
6
|
Request.new.tap do | request |
|
7
7
|
response = request.destroy( @path, @parameters )
|
8
|
-
if response
|
8
|
+
if response_is_error?( response )
|
9
|
+
result = response
|
10
|
+
elsif response.present?
|
9
11
|
result = response.resources
|
10
12
|
end
|
11
13
|
end
|
@@ -17,12 +19,16 @@ module Unimatrix::Authorization
|
|
17
19
|
response = nil
|
18
20
|
Request.new.tap do | request |
|
19
21
|
request.get( @path, @parameters ).tap do | response |
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if response_is_error?( response )
|
23
|
+
result = response
|
24
|
+
else
|
25
|
+
result = response.resources
|
26
|
+
if block_given?
|
27
|
+
case block.arity
|
28
|
+
when 0; yield
|
29
|
+
when 1; yield result
|
30
|
+
when 2; yield result, response
|
31
|
+
end
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
@@ -35,7 +41,9 @@ module Unimatrix::Authorization
|
|
35
41
|
Request.new.tap do | request |
|
36
42
|
serializer = Unimatrix::Serializer.new( objects )
|
37
43
|
response = request.post( @path, @parameters, serializer.serialize( node ) )
|
38
|
-
if response
|
44
|
+
if response_is_error?( response )
|
45
|
+
result = response
|
46
|
+
else
|
39
47
|
result = response.resources
|
40
48
|
if block_given?
|
41
49
|
case block.arity
|
@@ -55,6 +63,10 @@ module Unimatrix::Authorization
|
|
55
63
|
@parameters.deep_merge( parameters || {} )
|
56
64
|
)
|
57
65
|
end
|
66
|
+
|
67
|
+
protected; def response_is_error?( response )
|
68
|
+
response.is_a?( Error ) || response.is_a?( Unimatrix::Error )
|
69
|
+
end
|
58
70
|
|
59
71
|
end
|
60
72
|
|
@@ -7,6 +7,11 @@ module Unimatrix::Authorization
|
|
7
7
|
def initialize( default_parameters = {} )
|
8
8
|
uri = URI( Unimatrix.configuration.authorization_url )
|
9
9
|
@http = Net::HTTP.new( uri.host, uri.port )
|
10
|
+
|
11
|
+
timeout_limit = ( ENV[ 'TIMEOUT_LIMIT' ] || 60 ).to_i
|
12
|
+
|
13
|
+
@http.open_timeout = timeout_limit
|
14
|
+
@http.read_timeout = timeout_limit
|
10
15
|
|
11
16
|
@http.use_ssl = ( uri.scheme == 'https' )
|
12
17
|
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -15,36 +20,24 @@ module Unimatrix::Authorization
|
|
15
20
|
end
|
16
21
|
|
17
22
|
def get( path, parameters = {} )
|
18
|
-
|
19
|
-
|
20
|
-
begin
|
21
|
-
response = Response.new(
|
23
|
+
attempt_request do
|
24
|
+
Response.new(
|
22
25
|
@http.get( compose_request_path( path, parameters ) ),
|
23
26
|
path
|
24
27
|
)
|
25
|
-
rescue Timeout::Error
|
26
|
-
response = nil
|
27
28
|
end
|
28
|
-
|
29
|
-
response
|
30
29
|
end
|
31
30
|
|
32
31
|
def post( path, parameters = {}, body = {} )
|
33
|
-
|
34
|
-
|
35
|
-
begin
|
32
|
+
attempt_request do
|
36
33
|
request = Net::HTTP::Post.new(
|
37
34
|
compose_request_path( path, parameters ),
|
38
35
|
{ 'Content-Type' =>'application/json' }
|
39
36
|
)
|
40
37
|
request.body = body.to_json
|
41
38
|
|
42
|
-
|
43
|
-
rescue Timeout::Error
|
44
|
-
response = nil
|
39
|
+
Response.new( @http.request( request ), path )
|
45
40
|
end
|
46
|
-
|
47
|
-
response
|
48
41
|
end
|
49
42
|
|
50
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jackson Souza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|