apimatic_core 0.3.18 → 0.3.19

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: 2b0a483f088067743a544f3de82e94a1fd7e69c8ae909183b78f4d1ef5b1ae58
4
- data.tar.gz: cd450513cff448d0a5c26ab010965d1a6c96c69aaa4d28867a4837b23860ddd0
3
+ metadata.gz: 8036d7d4e85c7d9a51ba0cb35b55512f7f5ee7b9be1ae82539968818cb071647
4
+ data.tar.gz: a7c919a5d44e501c1dcb24c348a8a2d86397a7544cf909f9437a70b4e362cc13
5
5
  SHA512:
6
- metadata.gz: e979257d3120334ba5b91869185aabb76a370d9fb7e8dff380d11275be052dcee00162b46e72e426812f4228b0c93fb7eda06bdc12ecdfce931b2529d00475ec
7
- data.tar.gz: 2adbc4d4e20342ff76a26b90225a6cce77e0ff7ba2a6ee0d7e1904682369a561c513a5b6fe9668ed0fd801ec49d445d496f520ddc9b96e05934dabd1ee7d3d53
6
+ metadata.gz: 740e2f24d1386d43da34543a506044593a9e15dd879f894e83a2abb5f68d0497c4edc0c741dfcc73c5147f691eeab8abef8c2b9d005f0f2493ff3136f28dca20
7
+ data.tar.gz: a691fb1f4ebf03184ad11ad9d1662da02563d5f6208d71224ff6782474eb017c09e970053919816782684af64ec188de94ad0507f61c7ca2c72c75db24f0c144
data/README.md CHANGED
@@ -45,7 +45,7 @@ gem 'apimatic_core'
45
45
  | [`Single`](lib/apimatic-core/authentication/multiple/single_auth.rb) | Helper class to support single authentication |
46
46
 
47
47
 
48
- ## Configurations
48
+ ## Global Configuration
49
49
  | Name | Description |
50
50
  |------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
51
51
  | [`GlobalConfiguration`](lib/apimatic-core/configurations/global_configuration.rb ) | Class holding the global configuration properties to make a successful API Call |
@@ -63,10 +63,15 @@ gem 'apimatic_core'
63
63
  |-------------------------------------------------------------------------------|------------------------------------------|
64
64
  | [`HttpResponseFactory`](lib/apimatic-core/factories/http_response_factory.rb) | Factory class to create an HTTP Response |
65
65
 
66
+ ## HTTP Configuration
67
+ | Name | Description |
68
+ |-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
69
+ | [`HttpClientConfiguration`](lib/apimatic-core/http/configurations/http_client_configuration.rb) | Class used for configuring SDK by a user |
70
+ | [`ProxySettings`](lib/apimatic-core/http/configurations/proxy_settings.rb) | ProxySettings encapsulates HTTP proxy configuration for Faraday, e.g. address, port and optional basic authentication |
71
+
66
72
  ## HTTP
67
73
  | Name | Description |
68
74
  |-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
69
- | [`HttpClientConfiguration`](lib/apimatic-core/http/configurations/http_client_configuration.rb) | Class used for configuring SDK by a user |
70
75
  | [`HttpRequest`](lib/apimatic-core/http/request/http_request.rb) | Class which contains information about the HTTP Request |
71
76
  | [`ApiResponse`](lib/apimatic-core/http/response/api_response.rb) | Wrapper class for Api Response |
72
77
  | [`HttpResponse`](lib/apimatic-core/http/response/http_response.rb) | Class which contains information about the HTTP Response |
@@ -16,12 +16,13 @@ module CoreLibrary
16
16
  # @param [Boolean] verify Should verification be enabled.
17
17
  # @param http_callback A method to be used as http callback
18
18
  # @param [HttpClient] http_client An instance of HttpClient
19
+ # @param [ProxySettings] proxy_settings The configurable settings for proxy
19
20
  def initialize(
20
21
  connection: nil, adapter: :net_http_persistent, timeout: 60,
21
22
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
22
23
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
23
24
  retry_methods: %i[get put], cache: false, verify: true, http_callback: nil, http_client: nil,
24
- logging_configuration: nil
25
+ logging_configuration: nil, proxy_settings: nil
25
26
  )
26
27
  @response_factory = HttpResponseFactory.new
27
28
  @connection = connection
@@ -37,6 +38,7 @@ module CoreLibrary
37
38
  @cache = cache
38
39
  @http_client = http_client
39
40
  @logging_configuration = logging_configuration
41
+ @proxy_settings = proxy_settings
40
42
  end
41
43
 
42
44
  # Setter for http_client.
@@ -58,7 +60,8 @@ module CoreLibrary
58
60
  verify: @verify,
59
61
  http_callback: http_callback || DeepCloneUtils.deep_copy(@http_callback),
60
62
  http_client: DeepCloneUtils.deep_copy(@http_client),
61
- logging_configuration: DeepCloneUtils.deep_copy(@logging_configuration)
63
+ logging_configuration: DeepCloneUtils.deep_copy(@logging_configuration),
64
+ proxy_settings: DeepCloneUtils.deep_copy(@proxy_settings)
62
65
  )
63
66
  end
64
67
  end
@@ -0,0 +1,42 @@
1
+ module CoreLibrary
2
+ ##
3
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
4
+ # including optional basic authentication.
5
+ #
6
+ class ProxySettings
7
+ attr_accessor :address, :port, :username, :password
8
+
9
+ ##
10
+ # @param address [String] The proxy server address (e.g., 'http://localhost').
11
+ # @param port [Integer, nil] Optional proxy server port (e.g., 8080).
12
+ # @param username [String, nil] Optional proxy auth username.
13
+ # @param password [String, nil] Optional proxy auth password.
14
+ #
15
+ # @raise [ArgumentError] If address is invalid.
16
+ #
17
+ def initialize(address:, port: nil, username: nil, password: nil)
18
+ raise ArgumentError, 'Proxy address must be a non-empty string' unless address.is_a?(String) && !address.empty?
19
+
20
+ @address = address
21
+ @port = port
22
+ @username = username
23
+ @password = password
24
+ end
25
+
26
+ ##
27
+ # Converts the proxy settings into a Faraday-compatible hash.
28
+ #
29
+ # @return [Hash] A hash with keys :uri, :user, and :password (as applicable).
30
+ #
31
+ def to_h
32
+ uri_str = port ? "#{address}:#{port}" : address
33
+
34
+ {
35
+ uri: uri_str
36
+ }.tap do |hash|
37
+ hash[:user] = username if username
38
+ hash[:password] = password if password
39
+ end
40
+ end
41
+ end
42
+ end
data/lib/apimatic_core.rb CHANGED
@@ -30,6 +30,7 @@ require_relative 'apimatic-core/pagination/strategies/offset_pagination'
30
30
  require_relative 'apimatic-core/pagination/strategies/page_pagination'
31
31
 
32
32
  require_relative 'apimatic-core/http/configurations/http_client_configuration'
33
+ require_relative 'apimatic-core/http/configurations/proxy_settings'
33
34
  require_relative 'apimatic-core/http/request/http_request'
34
35
  require_relative 'apimatic-core/http/response/http_response'
35
36
  require_relative 'apimatic-core/http/response/api_response'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-11 00:00:00.000000000 Z
11
+ date: 2025-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces
@@ -170,6 +170,7 @@ files:
170
170
  - lib/apimatic-core/exceptions/one_of_validation_exception.rb
171
171
  - lib/apimatic-core/factories/http_response_factory.rb
172
172
  - lib/apimatic-core/http/configurations/http_client_configuration.rb
173
+ - lib/apimatic-core/http/configurations/proxy_settings.rb
173
174
  - lib/apimatic-core/http/http_call_context.rb
174
175
  - lib/apimatic-core/http/request/http_request.rb
175
176
  - lib/apimatic-core/http/response/api_response.rb