api_six_client 1.2.3 → 1.2.5

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: 1812f8b3dfef3826d6e890ef25788064f67d3ccd7b07ee7f446e8794e4ec44ec
4
- data.tar.gz: c00b159f4cbdfd8964f04f3f64921d44fbc0f1ca82851b36e6c347dd67349bed
3
+ metadata.gz: 21a2f166a3c9d795f709a20cee3a3abc731c79f98059f7c4e64781119aa5c073
4
+ data.tar.gz: db264a9c736d4eb52cdcdad4d0db9e225c0cbac9dbe204ce565856d46d90e982
5
5
  SHA512:
6
- metadata.gz: 041d88fef08dffc2204f419f93d8e56aa7c5fd63f589dc8918b3ba5bbf9d58978e46c4e2e6a494472282bc0495e2f5e918273461a5102df75315282a09619f4b
7
- data.tar.gz: 1fca1c026a14597f1c0e5ee086ee3451f8e8e10a7fede5ddf8bae37eb36a33283e7228b2e48cc9d6d280466c31eac8275f7c2fcd04f0dd9c5af6d0337eccb2ee
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.3)
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.3"
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
@@ -17,20 +18,26 @@ module ApiSixClient
17
18
  end
18
19
 
19
20
  class Brg < Base; end
20
- class Brg_P3 < Base; end
21
21
  class Gbk < Base; end
22
- class Kms < Base; end
23
- class Lyr < Base; end
24
22
  class Mat < Base; end
25
23
  class Val < Base; end
26
24
  class Prj < Base; end
27
- class Prj_P3 < Base; end
28
25
  class Fin < Base; end
29
26
  class Olc < Base; end
30
- class Eno < Base; end
31
- class Uas < Base; end
32
27
 
33
- 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
+
34
33
  class OlcInt < BaseInt; end
35
- 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
36
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.3
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-05-31 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