api_six_client 1.2.4 → 1.2.6

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: b9b4370ca10b750830b247e1cae6a3b4d37787a1374d26ea85bdc1cba6bdce66
4
- data.tar.gz: 4627739c9059dd2e846839e2913f1782e58e4bb84845a75d5114796945b7c14b
3
+ metadata.gz: 8135285e1f85df14ece68c7c636693b2f3ace1f23ec9dd5522633c36f22b1da1
4
+ data.tar.gz: 0a32d02140cce9c38301e2a6ac7bcda854968a426040187d2e1ba222b0762961
5
5
  SHA512:
6
- metadata.gz: b33d0f27a9955fca49a0e81496b6c3cbdd3a6e8df7ff4acf574874a898383ed5675b6baca16bc9479a3fbae8f22cd733a2f9c72a5632bbe0cfd4bf5a6b0f7328
7
- data.tar.gz: ebf9f9f7cce72a3035834335d4e8e483b34edf94f3b5c002e366c8942fda17cf33cc8283941cc72339de4926215be326a2912a0cc44787c71b71466781ef0a50
6
+ metadata.gz: 9ec31cba0fdaa8e4a4c7b5388a41a5f3294927456bc607ae167c7987d9567256817f0c8a294a7d593aa16cc7b2dbfdf3ff24dbee435bf0f1df028c7cf54a04ae
7
+ data.tar.gz: 7f0cb7ea861acb6bd497eda2b9e05bf784cf294b3a7ce1d501d1f7fa18b194a41d0e4303664315b5709632f1017c0e9e41b9b5b8c3db0eb62e8967ca13713808
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.6)
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.6"
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,27 @@ 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
41
+ class FinnInt < BaseV2Int; end
42
+ class LyrInt < BaseV2Int; end
34
43
  end
44
+
45
+ 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.6
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-24 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