zaikio-directory 0.0.10 → 0.0.11
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 07fb7419f188af643dfaa5440d77827a4bedd91b820e18a6714b8d45f194d2f7
|
|
4
|
+
data.tar.gz: 878c7ba7a273c9526c556727cc9673d02956298d5b820a1f724949557d73eab0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad30c796f5615df1ef8c1f61d8a11f01460d085db6c2e2e054bb25e588b36fec61ac657c66b019b1b6f5412f8568211af50b3aa25797c7cc31a8a63db89ccded
|
|
7
|
+
data.tar.gz: 65c882cdf8824f5bed2d7c1da73d7b8dcf03e89d74961b72010f04b365da04374289b319e5ef4a93a33f7d73641dde2fd869852dd215fa938443389c728e5e0a
|
data/lib/zaikio/directory.rb
CHANGED
|
@@ -28,24 +28,25 @@ module Zaikio
|
|
|
28
28
|
module Directory
|
|
29
29
|
class << self
|
|
30
30
|
attr_accessor :configuration
|
|
31
|
+
class_attribute :connection
|
|
31
32
|
|
|
32
33
|
def configure
|
|
33
|
-
|
|
34
|
+
self.connection = nil
|
|
34
35
|
self.configuration ||= Configuration.new
|
|
35
36
|
yield(configuration)
|
|
36
37
|
|
|
37
|
-
Base.connection =
|
|
38
|
+
Base.connection = create_connection
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def with_token(token)
|
|
41
|
-
AuthorizationMiddleware.token token
|
|
42
|
+
AuthorizationMiddleware.token = token
|
|
42
43
|
yield
|
|
43
44
|
ensure
|
|
44
45
|
AuthorizationMiddleware.reset_token
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
def with_basic_auth(login, password)
|
|
48
|
-
BasicAuthMiddleware.credentials [login, password]
|
|
49
|
+
BasicAuthMiddleware.credentials = [login, password]
|
|
49
50
|
yield
|
|
50
51
|
ensure
|
|
51
52
|
BasicAuthMiddleware.reset_credentials
|
|
@@ -59,8 +60,8 @@ module Zaikio
|
|
|
59
60
|
create_token_data(payload)
|
|
60
61
|
end
|
|
61
62
|
|
|
62
|
-
def
|
|
63
|
-
|
|
63
|
+
def create_connection
|
|
64
|
+
self.connection = Faraday.new(url: "#{configuration.host}/api/v1") do |c|
|
|
64
65
|
c.request :json
|
|
65
66
|
c.response :logger, configuration&.logger
|
|
66
67
|
c.use JSONParser
|
|
@@ -4,12 +4,10 @@ require "jwt"
|
|
|
4
4
|
module Zaikio
|
|
5
5
|
module Directory
|
|
6
6
|
class AuthorizationMiddleware < Faraday::Middleware
|
|
7
|
-
|
|
8
|
-
@token = nil
|
|
9
|
-
end
|
|
7
|
+
class_attribute :token
|
|
10
8
|
|
|
11
|
-
def self.
|
|
12
|
-
|
|
9
|
+
def self.reset_token
|
|
10
|
+
self.token = nil
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def call(request_env)
|
|
@@ -4,12 +4,10 @@ require "base64"
|
|
|
4
4
|
module Zaikio
|
|
5
5
|
module Directory
|
|
6
6
|
class BasicAuthMiddleware < Faraday::Middleware
|
|
7
|
-
|
|
8
|
-
@credentials = nil
|
|
9
|
-
end
|
|
7
|
+
class_attribute :credentials
|
|
10
8
|
|
|
11
|
-
def self.
|
|
12
|
-
|
|
9
|
+
def self.reset_credentials
|
|
10
|
+
self.credentials = nil
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def call(request_env)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zaikio-directory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- crispymtn
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2020-06-
|
|
13
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: jwt
|