api_six_client 1.2.4 → 1.2.5

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: b9b4370ca10b750830b247e1cae6a3b4d37787a1374d26ea85bdc1cba6bdce66
4
- data.tar.gz: 4627739c9059dd2e846839e2913f1782e58e4bb84845a75d5114796945b7c14b
3
+ metadata.gz: 21a2f166a3c9d795f709a20cee3a3abc731c79f98059f7c4e64781119aa5c073
4
+ data.tar.gz: db264a9c736d4eb52cdcdad4d0db9e225c0cbac9dbe204ce565856d46d90e982
5
5
  SHA512:
6
- metadata.gz: b33d0f27a9955fca49a0e81496b6c3cbdd3a6e8df7ff4acf574874a898383ed5675b6baca16bc9479a3fbae8f22cd733a2f9c72a5632bbe0cfd4bf5a6b0f7328
7
- data.tar.gz: ebf9f9f7cce72a3035834335d4e8e483b34edf94f3b5c002e366c8942fda17cf33cc8283941cc72339de4926215be326a2912a0cc44787c71b71466781ef0a50
6
+ metadata.gz: cc5da9873c531487096614b72649450bad42468c3dc14ce92742e2e32d905364f31981561da3e116017c1180e5bb3a5aa1b120a88803650710cab591e6edb18d
7
+ data.tar.gz: 13f16ac218af4b9fbc61934d25295e4a6ba5120515521524d2f09338a23e6aa25b6907845c019420d59ec0cc6c45c4e7d27d0b3edbc522f9c92d78ac50d47cae
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api_six_client (1.2.4)
4
+ api_six_client (1.2.5)
5
5
  faraday (~> 1)
6
6
 
7
7
  GEM
@@ -7,12 +7,13 @@ module ApiSixClient
7
7
  class Base
8
8
  attr_reader :endpoint
9
9
 
10
- def initialize(endpoint: nil, auth_token: nil)
11
- @endpoint = endpoint || ApiSixClient.config.endpoint
12
- @auth_token = auth_token || ApiSixClient.config.auth_token
10
+ def initialize(endpoint: nil, auth_token: nil, debug_mode: false, dm: false)
11
+ @endpoint = endpoint
12
+ @auth_token = auth_token
13
+ @debug_mode = debug_mode || dm
13
14
 
14
- raise Errors::EndpointIsEmpty unless @endpoint
15
- raise Errors::AuthTokenIsEmpty unless @auth_token
15
+ override_defaults
16
+ validate_config!
16
17
  end
17
18
 
18
19
  def post(path, params = {}, headers = {})
@@ -35,8 +36,20 @@ module ApiSixClient
35
36
  request __method__, path, params, headers
36
37
  end
37
38
 
39
+ protected
40
+
41
+ def override_defaults
42
+ @endpoint ||= ApiSixClient.config.endpoint
43
+ @auth_token ||= ApiSixClient.config.auth_token
44
+ end
45
+
38
46
  private
39
47
 
48
+ def validate_config!
49
+ raise Errors::EndpointIsEmpty unless @endpoint
50
+ raise Errors::AuthTokenIsEmpty unless @auth_token
51
+ end
52
+
40
53
  def service_path
41
54
  self.class.name.demodulize.underscore
42
55
  end
@@ -61,6 +74,8 @@ module ApiSixClient
61
74
 
62
75
  faraday.request :url_encoded
63
76
  faraday.adapter :net_http
77
+
78
+ faraday.response :logger, ::Logger.new(STDOUT), bodies: true if @debug_mode
64
79
  end
65
80
  end
66
81
  end
@@ -2,12 +2,11 @@
2
2
 
3
3
  module ApiSixClient
4
4
  class BaseInt < Base
5
- def initialize(endpoint: nil, auth_token: nil)
5
+ protected
6
+
7
+ def override_defaults
6
8
  @endpoint = ApiSixClient.config.endpoint_int
7
9
  @auth_token = ApiSixClient.config.auth_token_int
8
-
9
- raise Errors::EndpointIsEmpty unless @endpoint
10
- raise Errors::AuthTokenIsEmpty unless @auth_token
11
10
  end
12
11
  end
13
12
  end
@@ -2,12 +2,11 @@
2
2
 
3
3
  module ApiSixClient
4
4
  class BaseV2 < Base
5
- def initialize(endpoint: nil, auth_token: nil)
5
+ protected
6
+
7
+ def override_defaults
6
8
  @endpoint = ApiSixClient.config.endpoint_v2
7
9
  @auth_token = ApiSixClient.config.auth_token_v2
8
-
9
- raise Errors::EndpointIsEmpty unless @endpoint
10
- raise Errors::AuthTokenIsEmpty unless @auth_token
11
10
  end
12
11
  end
13
12
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApiSixClient
4
+ class BaseV2Int < Base
5
+ protected
6
+
7
+ def override_defaults
8
+ @endpoint = ApiSixClient.config.endpoint_v2_int
9
+ @auth_token = ApiSixClient.config.auth_token_v2_int
10
+ end
11
+ end
12
+ end
@@ -5,5 +5,6 @@ module ApiSixClient
5
5
  attr_accessor :endpoint, :auth_token
6
6
  attr_accessor :endpoint_v2, :auth_token_v2
7
7
  attr_accessor :endpoint_int, :auth_token_int
8
+ attr_accessor :endpoint_v2_int, :auth_token_v2_int
8
9
  end
9
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApiSixClient
4
- VERSION = "1.2.4"
4
+ VERSION = "1.2.5"
5
5
  end
@@ -5,6 +5,7 @@ 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_v2_int'
8
9
  require 'api_six_client/errors'
9
10
 
10
11
  module ApiSixClient
@@ -18,17 +19,25 @@ module ApiSixClient
18
19
 
19
20
  class Brg < Base; end
20
21
  class Gbk < Base; end
21
- class Kms < Base; end
22
- class Lyr < Base; end
23
22
  class Mat < Base; end
24
23
  class Val < Base; end
25
24
  class Prj < Base; end
26
- class Finn < Base; end
25
+ class Fin < Base; end
27
26
  class Olc < Base; end
28
- class Eno < Base; end
29
- class Uas < Base; end
30
27
 
31
- class AuthInt < BaseInt; end
28
+ class Kms < BaseV2; end
29
+ class Lyr < BaseV2; end
30
+ class Eno < BaseV2; end
31
+ class Uas < BaseV2; end
32
+
32
33
  class OlcInt < BaseInt; end
33
- class UasInt < BaseInt; end
34
+ class BrgInt < BaseInt; end
35
+ class PrjInt < BaseInt; end
36
+
37
+ class AuthInt < BaseV2Int; end
38
+ class UasInt < BaseV2Int; end
39
+ class NtfInt < BaseV2Int; end
40
+ class MatInt < BaseV2Int; end
34
41
  end
42
+
43
+ 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.4
4
+ version: 1.2.5
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-09-25 00:00:00.000000000 Z
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -44,6 +44,7 @@ files:
44
44
  - lib/api_six_client/base.rb
45
45
  - lib/api_six_client/base_int.rb
46
46
  - lib/api_six_client/base_v2.rb
47
+ - lib/api_six_client/base_v2_int.rb
47
48
  - lib/api_six_client/config.rb
48
49
  - lib/api_six_client/errors.rb
49
50
  - lib/api_six_client/version.rb