api_six_client 1.2.11 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f01ce06723b2cf886512fcb0ce13a0d66d6bb0cade9e9702456a6285f9bfb869
4
- data.tar.gz: 2839a44a8533e8f76d6cd2af9b1f19b9f59b2e387a998a5782567a5ebbaae06a
3
+ metadata.gz: 1981a4778c9a65d39d53c02a21b5194a459f00bfa07eeb9dd6853d31b290b35b
4
+ data.tar.gz: e0d48db9fe20e42a52446428a7884f4cfedf93dd44a0e5a2d6ba30a434a78979
5
5
  SHA512:
6
- metadata.gz: 710996bcb16a2a030bf60acc5c6cc580cd86e8549fe40c03d8500714abcbb599a2ee5dde9f9792fc4c074ce819806c30a1bff59dc130ad9d05ba76de71ee2e88
7
- data.tar.gz: fad27ce4c99f9a947f2635d108c5219b7167e2d023c7d306ffa924468b4c293dd33334175f755e003f1cb56f52c16bacbb4b9d58a8caa1185e2ac0cc131a6b82
6
+ metadata.gz: e00680c65f4a3763da3cf87b9c481f44d3f4d883005858f88498dc09e092b009403ee5ff2fbd2c0fc4c173db79b6cdc61922285689f9ffd0ea23390150f9e7e3
7
+ data.tar.gz: f4c47e96e42bb719f59b2bb94da70276b2c77778d79ba548a98ae8e783e1fc8ff17fe76cae1101ca56cc7f5f73080782923c2ce965c3fbb369477ad2d404e3fd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api_six_client (1.2.11)
4
+ api_six_client (1.2.13)
5
5
  faraday (~> 1)
6
6
 
7
7
  GEM
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApiSixClient
4
- VERSION = "1.2.11"
4
+ VERSION = "1.2.13"
5
5
  end
@@ -43,6 +43,9 @@ module ApiSixClient
43
43
  class LyrInt < BaseInt; end
44
44
  class GbkInt < BaseInt; end
45
45
  class Val < BaseInt; end
46
+ class StataInt < BaseInt; end
47
+ class ParaInt < BaseInt; end
48
+ class CunaInt < BaseInt; end
46
49
  end
47
50
 
48
51
  A6C = ApiSixClient
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.2.11
4
+ version: 1.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Dobrorodnov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-28 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday