api_six_client 1.2.14 → 1.3.0
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 +5 -25
- data/api_six_client.gemspec +1 -1
- data/lib/api_six_client/base.rb +7 -38
- data/lib/api_six_client/base_int.rb +3 -43
- data/lib/api_six_client/base_v2.rb +4 -3
- data/lib/api_six_client/config.rb +0 -2
- data/lib/api_six_client/errors.rb +0 -1
- data/lib/api_six_client/version.rb +1 -1
- data/lib/api_six_client.rb +9 -25
- metadata +4 -6
- data/lib/api_six_client/base_hidden.rb +0 -15
- data/lib/api_six_client/base_v2_int.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd36ec4d129e75145e125183cc544adc31692f3dc24d4d03262b232d75e2040e
|
4
|
+
data.tar.gz: b78b1b6d2e482e2cd6fc4a524dcb4b748ed5014b508eb43ae61d110ac3c17f3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300c27ce6399958c58707ec63b08b3c0228d254a117b619e811a7bc1e7ff879216d703e48b6b1bb22aaec19b90da21c229808e3b4297700783d4d7f450d3a76e
|
7
|
+
data.tar.gz: 28cafdda86f08a0882c4c4cf15a08fe4be9ce4c65ab33c4bb7cbac8b828c4e66c4a16d47b534e0cc52878d9bee569ebdd37a85b2a313457193dceb4e7c686f6e
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
api_six_client (1.
|
5
|
-
faraday (~>
|
4
|
+
api_six_client (1.3.0)
|
5
|
+
faraday (~> 2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
faraday (
|
11
|
-
faraday-
|
12
|
-
faraday-em_synchrony (~> 1.0)
|
13
|
-
faraday-excon (~> 1.1)
|
14
|
-
faraday-httpclient (~> 1.0)
|
15
|
-
faraday-multipart (~> 1.0)
|
16
|
-
faraday-net_http (~> 1.0)
|
17
|
-
faraday-net_http_persistent (~> 1.0)
|
18
|
-
faraday-patron (~> 1.0)
|
19
|
-
faraday-rack (~> 1.0)
|
20
|
-
faraday-retry (~> 1.0)
|
10
|
+
faraday (2.7.6)
|
11
|
+
faraday-net_http (>= 2.0, < 3.1)
|
21
12
|
ruby2_keywords (>= 0.0.4)
|
22
|
-
faraday-
|
23
|
-
faraday-em_synchrony (1.0.0)
|
24
|
-
faraday-excon (1.1.0)
|
25
|
-
faraday-httpclient (1.0.1)
|
26
|
-
faraday-multipart (1.0.4)
|
27
|
-
multipart-post (~> 2)
|
28
|
-
faraday-net_http (1.0.1)
|
29
|
-
faraday-net_http_persistent (1.2.0)
|
30
|
-
faraday-patron (1.0.0)
|
31
|
-
faraday-rack (1.0.0)
|
32
|
-
faraday-retry (1.0.3)
|
33
|
-
multipart-post (2.3.0)
|
13
|
+
faraday-net_http (3.0.2)
|
34
14
|
rake (13.0.6)
|
35
15
|
ruby2_keywords (0.0.5)
|
36
16
|
|
data/api_six_client.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.add_dependency 'faraday', '~>
|
32
|
+
spec.add_dependency 'faraday', '~> 2'
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, checkout our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/api_six_client/base.rb
CHANGED
@@ -7,13 +7,12 @@ module ApiSixClient
|
|
7
7
|
class Base
|
8
8
|
attr_reader :endpoint
|
9
9
|
|
10
|
-
def initialize(endpoint: nil, auth_token: nil
|
11
|
-
@endpoint = endpoint
|
12
|
-
@auth_token = auth_token
|
13
|
-
@debug_mode = debug_mode || dm
|
10
|
+
def initialize(endpoint: nil, auth_token: nil)
|
11
|
+
@endpoint = endpoint || ApiSixClient.config.endpoint
|
12
|
+
@auth_token = auth_token || ApiSixClient.config.auth_token
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
raise Errors::EndpointIsEmpty unless @endpoint
|
15
|
+
raise Errors::AuthTokenIsEmpty unless @auth_token
|
17
16
|
end
|
18
17
|
|
19
18
|
def post(path, params = {}, headers = {})
|
@@ -36,42 +35,14 @@ module ApiSixClient
|
|
36
35
|
request __method__, path, params, headers
|
37
36
|
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
def deprecation_msg
|
42
|
-
Rails.logger.warn("#{self.class} is deprecated") if defined?(Rails)
|
43
|
-
end
|
44
|
-
|
45
|
-
def override_defaults
|
46
|
-
@endpoint ||= ApiSixClient.config.endpoint
|
47
|
-
@auth_token ||= ApiSixClient.config.auth_token
|
48
|
-
end
|
38
|
+
private
|
49
39
|
|
50
40
|
def service_path
|
51
41
|
self.class.name.demodulize.underscore
|
52
42
|
end
|
53
43
|
|
54
|
-
private
|
55
|
-
|
56
|
-
def validate_config!
|
57
|
-
raise Errors::EndpointIsEmpty unless @endpoint
|
58
|
-
raise Errors::AuthTokenIsEmpty unless @auth_token
|
59
|
-
end
|
60
|
-
|
61
44
|
def request(method, path, params = {}, headers = {})
|
62
|
-
|
63
|
-
|
64
|
-
response = nil
|
65
|
-
begin
|
66
|
-
response = connection.run_request(method, "#{endpoint}/#{service_path}/#{path}", params.to_json, headers)
|
67
|
-
rescue Faraday::Error => e
|
68
|
-
if defined?(Rails)
|
69
|
-
Rails.logger.error "Message: #{e.message}, caused by: #{self.class.name}##{path}"
|
70
|
-
end
|
71
|
-
|
72
|
-
raise e
|
73
|
-
end
|
74
|
-
|
45
|
+
response = connection.run_request(method, "#{endpoint}/#{service_path}/#{path}", params.to_json, headers)
|
75
46
|
res = JSON.parse(response.body)
|
76
47
|
|
77
48
|
return res.with_indifferent_access if res.is_a?(Hash)
|
@@ -90,8 +61,6 @@ module ApiSixClient
|
|
90
61
|
|
91
62
|
faraday.request :url_encoded
|
92
63
|
faraday.adapter :net_http
|
93
|
-
|
94
|
-
faraday.response :logger, ::Logger.new(STDOUT), bodies: true if @debug_mode
|
95
64
|
end
|
96
65
|
end
|
97
66
|
end
|
@@ -2,52 +2,12 @@
|
|
2
2
|
|
3
3
|
module ApiSixClient
|
4
4
|
class BaseInt < Base
|
5
|
-
|
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
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def deprecation_msg
|
25
|
-
end
|
26
|
-
|
27
|
-
def override_defaults
|
5
|
+
def initialize(endpoint: nil, auth_token: nil)
|
28
6
|
@endpoint = ApiSixClient.config.endpoint_int
|
29
7
|
@auth_token = ApiSixClient.config.auth_token_int
|
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
8
|
|
50
|
-
|
9
|
+
raise Errors::EndpointIsEmpty unless @endpoint
|
10
|
+
raise Errors::AuthTokenIsEmpty unless @auth_token
|
51
11
|
end
|
52
12
|
end
|
53
13
|
end
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module ApiSixClient
|
4
4
|
class BaseV2 < Base
|
5
|
-
|
6
|
-
|
7
|
-
def override_defaults
|
5
|
+
def initialize(endpoint: nil, auth_token: nil)
|
8
6
|
@endpoint = ApiSixClient.config.endpoint_v2
|
9
7
|
@auth_token = ApiSixClient.config.auth_token_v2
|
8
|
+
|
9
|
+
raise Errors::EndpointIsEmpty unless @endpoint
|
10
|
+
raise Errors::AuthTokenIsEmpty unless @auth_token
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/api_six_client.rb
CHANGED
@@ -5,8 +5,6 @@ require 'api_six_client/config'
|
|
5
5
|
require 'api_six_client/base'
|
6
6
|
require 'api_six_client/base_v2'
|
7
7
|
require 'api_six_client/base_int'
|
8
|
-
require 'api_six_client/base_hidden'
|
9
|
-
require 'api_six_client/base_v2_int'
|
10
8
|
require 'api_six_client/errors'
|
11
9
|
|
12
10
|
module ApiSixClient
|
@@ -19,34 +17,20 @@ module ApiSixClient
|
|
19
17
|
end
|
20
18
|
|
21
19
|
class Brg < Base; end
|
20
|
+
class Brg_P3 < Base; end
|
22
21
|
class Gbk < Base; end
|
22
|
+
class Kms < Base; end
|
23
|
+
class Lyr < Base; end
|
23
24
|
class Mat < Base; end
|
25
|
+
class Val < Base; end
|
24
26
|
class Prj < Base; end
|
27
|
+
class Prj_P3 < Base; end
|
25
28
|
class Fin < Base; end
|
26
29
|
class Olc < Base; end
|
30
|
+
class Eno < Base; end
|
31
|
+
class Uas < Base; end
|
27
32
|
|
28
|
-
class
|
29
|
-
class
|
30
|
-
class Eno < BaseV2; end
|
31
|
-
class Uas < BaseV2; end
|
32
|
-
|
33
|
-
class OlcInt < BaseHidden; end
|
34
|
-
class AuthInt < BaseHidden; end
|
35
|
-
|
36
|
-
class PrjInt < BaseInt; end
|
33
|
+
class AuthInt < BaseInt; end
|
34
|
+
class OlcInt < BaseInt; end
|
37
35
|
class UasInt < BaseInt; end
|
38
|
-
class BrgInt < BaseInt; end
|
39
|
-
class CadInt < BaseInt; end
|
40
|
-
class NtfInt < BaseInt; end
|
41
|
-
class MatInt < BaseInt; end
|
42
|
-
class FinnInt < BaseInt; end
|
43
|
-
class LyrInt < BaseInt; end
|
44
|
-
class GbkInt < BaseInt; end
|
45
|
-
class Val < BaseInt; end
|
46
|
-
class StataInt < BaseInt; end
|
47
|
-
class ParaInt < BaseInt; end
|
48
|
-
class CunaInt < BaseInt; end
|
49
|
-
class LegaInt < BaseInt; end
|
50
36
|
end
|
51
|
-
|
52
|
-
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Dobrorodnov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
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
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
description: ApiSix is a Ruby gem that provides access to various Lytics services.
|
28
28
|
email:
|
29
29
|
- ei.dobrorodnov@gmail.com
|
@@ -42,10 +42,8 @@ files:
|
|
42
42
|
- bin/setup
|
43
43
|
- lib/api_six_client.rb
|
44
44
|
- lib/api_six_client/base.rb
|
45
|
-
- lib/api_six_client/base_hidden.rb
|
46
45
|
- lib/api_six_client/base_int.rb
|
47
46
|
- lib/api_six_client/base_v2.rb
|
48
|
-
- lib/api_six_client/base_v2_int.rb
|
49
47
|
- lib/api_six_client/config.rb
|
50
48
|
- lib/api_six_client/errors.rb
|
51
49
|
- lib/api_six_client/version.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ApiSixClient
|
4
|
-
class BaseHidden < Base
|
5
|
-
protected
|
6
|
-
|
7
|
-
def deprecation_msg
|
8
|
-
end
|
9
|
-
|
10
|
-
def override_defaults
|
11
|
-
@endpoint = ApiSixClient.config.endpoint_int
|
12
|
-
@auth_token = ApiSixClient.config.auth_token_hidden
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|