api_six_client 1.4.16 → 1.4.17
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/Gemfile.lock +1 -1
- data/lib/api_six_client/base.rb +4 -4
- data/lib/api_six_client/base_int.rb +38 -0
- data/lib/api_six_client/version.rb +1 -1
- data/lib/api_six_client.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b189d81e839dbb2a9a26192da8f801c63d9c435210ce22064a40c229875cc100
|
4
|
+
data.tar.gz: 4c70d91525ec16bf8aec13e5d21d178fce3492396d74675dbcff305765ed68d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106ac55ca45e0b0e132aed0b7d2fc020fbca63f1206acb73cbb920ccb24613da4769eed70160ea707188a8587b15845c16b8be282e033f43dad60ec133fdec7f
|
7
|
+
data.tar.gz: e4167af44078f638de5d69f75cb365e1ffef905a7c6a9b72940e0a1f2bce8cafdf4588b6a5908e9377fe762093f6cdc4b2d5baf10cfabd65859b9703d2adf594
|
data/Gemfile.lock
CHANGED
data/lib/api_six_client/base.rb
CHANGED
@@ -47,6 +47,10 @@ module ApiSixClient
|
|
47
47
|
@auth_token ||= ApiSixClient.config.auth_token
|
48
48
|
end
|
49
49
|
|
50
|
+
def service_path
|
51
|
+
self.class.name.demodulize.underscore
|
52
|
+
end
|
53
|
+
|
50
54
|
private
|
51
55
|
|
52
56
|
def validate_config!
|
@@ -54,10 +58,6 @@ module ApiSixClient
|
|
54
58
|
raise Errors::AuthTokenIsEmpty unless @auth_token
|
55
59
|
end
|
56
60
|
|
57
|
-
def service_path
|
58
|
-
self.class.name.demodulize.underscore
|
59
|
-
end
|
60
|
-
|
61
61
|
def request(method, path, params = {}, headers = {})
|
62
62
|
deprecation_msg
|
63
63
|
|
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
module ApiSixClient
|
4
4
|
class BaseInt < Base
|
5
|
+
APP_OUTSIDE_K8S = %w[Grunnbok Brreg Projects]
|
6
|
+
SERVICES_OUTSIDE_K8S = %w[gbk_int prj_int brg_int]
|
7
|
+
DEFAULT_INTRANET_MAPPING = ->(service_name) {
|
8
|
+
{ k8s_service: "http://#{service_name.gsub('_int', '-api')}", api_int_path: 'api_int'}
|
9
|
+
}
|
10
|
+
INTRANET_MAPPING = {
|
11
|
+
'olc_int' => { k8s_service: 'http://core-web:3000', api_int_path: 'api_hiden' },
|
12
|
+
'cad_int' => { k8s_service: 'http://core-web:3000', api_int_path: 'api_int' },
|
13
|
+
'val' => { k8s_service: 'http://val:8000', api_int_path: 'api' },
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
def endpoint
|
17
|
+
return super unless intranet_connection?
|
18
|
+
|
19
|
+
current_service[:k8s_service]
|
20
|
+
end
|
21
|
+
|
5
22
|
protected
|
6
23
|
|
7
24
|
def deprecation_msg
|
@@ -11,5 +28,26 @@ module ApiSixClient
|
|
11
28
|
@endpoint = ApiSixClient.config.endpoint_int
|
12
29
|
@auth_token = ApiSixClient.config.auth_token_int
|
13
30
|
end
|
31
|
+
|
32
|
+
def service_path
|
33
|
+
return super unless intranet_connection?
|
34
|
+
|
35
|
+
current_service[:api_int_path]
|
36
|
+
end
|
37
|
+
|
38
|
+
def intranet_connection?
|
39
|
+
return false if Rails.application.class.to_s.split('::').first.in?(APP_OUTSIDE_K8S)
|
40
|
+
return false if ENV['RAILS_ENV'] == 'development'
|
41
|
+
|
42
|
+
current_service.present?
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def current_service
|
47
|
+
service_name = self.class.name.demodulize.underscore
|
48
|
+
return nil if service_name.in?(SERVICES_OUTSIDE_K8S)
|
49
|
+
|
50
|
+
INTRANET_MAPPING[service_name] || DEFAULT_INTRANET_MAPPING.call(service_name)
|
51
|
+
end
|
14
52
|
end
|
15
53
|
end
|
data/lib/api_six_client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_six_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Dobrorodnov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|