test-words-api-client-sdk 4.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -10
- data/lib/words_api/client.rb +4 -2
- data/lib/words_api/configuration.rb +8 -5
- data/lib/words_api/logging/configuration/api_logging_configuration.rb +114 -0
- data/lib/words_api/logging/sdk_logger.rb +17 -0
- data/lib/words_api.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa6d9df0cff204ce217ed8c3adc1bffbc7f5f68f91a92346e8a4955b91084d9
|
4
|
+
data.tar.gz: e4282ba194c12e54567a0ac293f1557175b4ad03397910561f7e94065eb69641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992c9d288afdb6cf0f16caf985bf2075ae7f478777c7982f39562452e6de20ac866afb7a342e8b3a9474bc7e1ecc53c4159c33da6d7655b214bbf0c8e538e6c2
|
7
|
+
data.tar.gz: 99e926253b2af43e52ec51ac938c26a1249de9e67f08a1b5095c9875b82cf5c73484ffe4e5d08746114879dd6d289ae1108448a0598a042fdcee025efda8bffe
|
data/README.md
CHANGED
@@ -10,16 +10,16 @@ Words API lets you retrieve information about English words, including definitio
|
|
10
10
|
Install the gem from the command line:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem install test-words-api-client-sdk -v
|
13
|
+
gem install test-words-api-client-sdk -v 5.0.1
|
14
14
|
```
|
15
15
|
|
16
16
|
Or add the gem to your Gemfile and run `bundle`:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'test-words-api-client-sdk', '
|
19
|
+
gem 'test-words-api-client-sdk', '5.0.1'
|
20
20
|
```
|
21
21
|
|
22
|
-
For additional gem details, see the [RubyGems page for the test-words-api-client-sdk gem](https://rubygems.org/gems/test-words-api-client-sdk/versions/
|
22
|
+
For additional gem details, see the [RubyGems page for the test-words-api-client-sdk gem](https://rubygems.org/gems/test-words-api-client-sdk/versions/5.0.1).
|
23
23
|
|
24
24
|
## Test the SDK
|
25
25
|
|
@@ -31,7 +31,7 @@ rake
|
|
31
31
|
|
32
32
|
## Initialize the API Client
|
33
33
|
|
34
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
34
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/client.md)
|
35
35
|
|
36
36
|
The following parameters are configurable for the API Client:
|
37
37
|
|
@@ -46,7 +46,8 @@ The following parameters are configurable for the API Client:
|
|
46
46
|
| `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
47
47
|
| `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
48
48
|
| `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
49
|
-
| `
|
49
|
+
| `logging_configuration` | [`LoggingConfiguration`](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
|
50
|
+
| `custom_header_authentication_credentials` | [`CustomHeaderAuthenticationCredentials`](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
|
50
51
|
|
51
52
|
The API client can be initialized as follows:
|
52
53
|
|
@@ -54,6 +55,15 @@ The API client can be initialized as follows:
|
|
54
55
|
client = WordsApi::Client.new(
|
55
56
|
custom_header_authentication_credentials: CustomHeaderAuthenticationCredentials.new(
|
56
57
|
x_rapid_api_key: 'X-RapidAPI-Key'
|
58
|
+
),
|
59
|
+
logging_configuration: LoggingConfiguration.new(
|
60
|
+
log_level: Logger::INFO,
|
61
|
+
request_logging_config: RequestLoggingConfiguration.new(
|
62
|
+
log_body: true
|
63
|
+
),
|
64
|
+
response_logging_config: ResponseLoggingConfiguration.new(
|
65
|
+
log_headers: true
|
66
|
+
)
|
57
67
|
)
|
58
68
|
)
|
59
69
|
```
|
@@ -62,15 +72,19 @@ client = WordsApi::Client.new(
|
|
62
72
|
|
63
73
|
This API uses the following authentication schemes.
|
64
74
|
|
65
|
-
* [`RapidAPI-Key (Custom Header Signature)`](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
75
|
+
* [`RapidAPI-Key (Custom Header Signature)`](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/auth/custom-header-signature.md)
|
66
76
|
|
67
77
|
## List of APIs
|
68
78
|
|
69
|
-
* [AP Is](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
79
|
+
* [AP Is](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/controllers/ap-is.md)
|
70
80
|
|
71
81
|
## Classes Documentation
|
72
82
|
|
73
|
-
* [Utility Classes](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
74
|
-
* [HttpResponse](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
75
|
-
* [HttpRequest](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/
|
83
|
+
* [Utility Classes](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/utility-classes.md)
|
84
|
+
* [HttpResponse](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/http-response.md)
|
85
|
+
* [HttpRequest](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/http-request.md)
|
86
|
+
* [LoggingConfiguration](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/logging-configuration.md)
|
87
|
+
* [RequestLoggingConfiguration](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/request-logging-configuration.md)
|
88
|
+
* [ResponseLoggingConfiguration](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/response-logging-configuration.md)
|
89
|
+
* [Abstract Logger](https://www.github.com/sufyankhanrao/test-words-api-ruby-sdk/tree/5.0.1/doc/abstract-logger.md)
|
76
90
|
|
data/lib/words_api/client.rb
CHANGED
@@ -20,8 +20,9 @@ module WordsApi
|
|
20
20
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
21
21
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
22
22
|
retry_methods: %i[get put], http_callback: nil,
|
23
|
-
environment: Environment::PRODUCTION,
|
24
|
-
|
23
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
24
|
+
x_rapid_api_key: nil, custom_header_authentication_credentials: nil,
|
25
|
+
config: nil
|
25
26
|
)
|
26
27
|
@config = if config.nil?
|
27
28
|
Configuration.new(
|
@@ -30,6 +31,7 @@ module WordsApi
|
|
30
31
|
backoff_factor: backoff_factor,
|
31
32
|
retry_statuses: retry_statuses,
|
32
33
|
retry_methods: retry_methods, http_callback: http_callback,
|
34
|
+
logging_configuration: logging_configuration,
|
33
35
|
environment: environment, x_rapid_api_key: x_rapid_api_key,
|
34
36
|
custom_header_authentication_credentials: custom_header_authentication_credentials
|
35
37
|
)
|
@@ -37,14 +37,15 @@ module WordsApi
|
|
37
37
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
38
38
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
39
39
|
retry_methods: %i[get put], http_callback: nil,
|
40
|
-
environment: Environment::PRODUCTION,
|
41
|
-
custom_header_authentication_credentials: nil
|
40
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
41
|
+
x_rapid_api_key: nil, custom_header_authentication_credentials: nil
|
42
42
|
)
|
43
43
|
|
44
44
|
super connection: connection, adapter: adapter, timeout: timeout,
|
45
45
|
max_retries: max_retries, retry_interval: retry_interval,
|
46
46
|
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
47
|
-
retry_methods: retry_methods, http_callback: http_callback
|
47
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
48
|
+
logging_configuration: logging_configuration
|
48
49
|
|
49
50
|
# Current API environment
|
50
51
|
@environment = String(environment)
|
@@ -64,7 +65,8 @@ module WordsApi
|
|
64
65
|
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
65
66
|
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
66
67
|
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
67
|
-
|
68
|
+
logging_configuration: nil, environment: nil,
|
69
|
+
x_rapid_api_key: nil,
|
68
70
|
custom_header_authentication_credentials: nil)
|
69
71
|
connection ||= self.connection
|
70
72
|
adapter ||= self.adapter
|
@@ -75,6 +77,7 @@ module WordsApi
|
|
75
77
|
retry_statuses ||= self.retry_statuses
|
76
78
|
retry_methods ||= self.retry_methods
|
77
79
|
http_callback ||= self.http_callback
|
80
|
+
logging_configuration ||= self.logging_configuration
|
78
81
|
environment ||= self.environment
|
79
82
|
custom_header_authentication_credentials = create_auth_credentials_object(
|
80
83
|
x_rapid_api_key,
|
@@ -86,7 +89,7 @@ module WordsApi
|
|
86
89
|
max_retries: max_retries, retry_interval: retry_interval,
|
87
90
|
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
88
91
|
retry_methods: retry_methods, http_callback: http_callback,
|
89
|
-
environment: environment,
|
92
|
+
logging_configuration: logging_configuration, environment: environment,
|
90
93
|
custom_header_authentication_credentials: custom_header_authentication_credentials
|
91
94
|
)
|
92
95
|
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# words_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WordsApi
|
7
|
+
# Initializes a new instance of RequestLoggingConfiguration.
|
8
|
+
class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
|
9
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
10
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
11
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
12
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
13
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
14
|
+
# Default is an empty array.
|
15
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
16
|
+
headers_to_exclude: nil, headers_to_unmask: nil,
|
17
|
+
include_query_in_path: false)
|
18
|
+
super(
|
19
|
+
log_body,
|
20
|
+
log_headers,
|
21
|
+
headers_to_exclude,
|
22
|
+
headers_to_include,
|
23
|
+
headers_to_unmask,
|
24
|
+
include_query_in_path
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
29
|
+
headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
|
30
|
+
log_body ||= self.log_body
|
31
|
+
log_headers ||= self.log_headers
|
32
|
+
headers_to_include ||= self.headers_to_include
|
33
|
+
headers_to_exclude ||= self.headers_to_exclude
|
34
|
+
headers_to_unmask ||= self.headers_to_unmask
|
35
|
+
include_query_in_path ||= self.include_query_in_path
|
36
|
+
|
37
|
+
RequestLoggingConfiguration.class.new(log_body: log_body, log_headers: log_headers,
|
38
|
+
headers_to_include: headers_to_include,
|
39
|
+
headers_to_exclude: headers_to_exclude,
|
40
|
+
headers_to_unmask: headers_to_unmask,
|
41
|
+
include_query_in_path: include_query_in_path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes a new instance of ResponseLoggingConfiguration.
|
46
|
+
class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
|
47
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
48
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
49
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
50
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
51
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
52
|
+
# Default is an empty array.
|
53
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
54
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
55
|
+
super(
|
56
|
+
log_body,
|
57
|
+
log_headers,
|
58
|
+
headers_to_exclude,
|
59
|
+
headers_to_include,
|
60
|
+
headers_to_unmask
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
65
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
66
|
+
log_body ||= self.log_body
|
67
|
+
log_headers ||= self.log_headers
|
68
|
+
headers_to_include ||= self.headers_to_include
|
69
|
+
headers_to_exclude ||= self.headers_to_exclude
|
70
|
+
headers_to_unmask ||= self.headers_to_unmask
|
71
|
+
|
72
|
+
ResponseLoggingConfiguration.new(log_body: log_body, log_headers: log_headers,
|
73
|
+
headers_to_include: headers_to_include,
|
74
|
+
headers_to_exclude: headers_to_exclude,
|
75
|
+
headers_to_unmask: headers_to_unmask)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Initializes a new instance of LoggingConfiguration.
|
80
|
+
class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
|
81
|
+
# @param logger [LoggerInterface] The logger to use for logging messages.
|
82
|
+
# @param log_level [LogLevel] The log level to determine which messages should be logged.
|
83
|
+
# @param request_logging_config [RequestLoggingConfiguration] Options for logging HTTP requests.
|
84
|
+
# @param response_logging_config [ResponseLoggingConfiguration] Options for logging HTTP responses.
|
85
|
+
# @param mask_sensitive_headers [Boolean] Indicates whether sensitive headers should be masked in logged messages.
|
86
|
+
def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
|
87
|
+
request_logging_config: nil,
|
88
|
+
response_logging_config: nil)
|
89
|
+
request_logging_config ||= RequestLoggingConfiguration.new
|
90
|
+
response_logging_config ||= ResponseLoggingConfiguration.new
|
91
|
+
super(
|
92
|
+
logger,
|
93
|
+
log_level,
|
94
|
+
request_logging_config,
|
95
|
+
response_logging_config,
|
96
|
+
mask_sensitive_headers
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
|
101
|
+
request_logging_config: nil, response_logging_config: nil)
|
102
|
+
logger ||= self.logger
|
103
|
+
log_level ||= self.log_level
|
104
|
+
mask_sensitive_headers = self.mask_sensitive_headers ||= mask_sensitive_headers
|
105
|
+
request_logging_config ||= self.request_logging_config.clone
|
106
|
+
response_logging_config ||= self.response_logging_config.clone
|
107
|
+
|
108
|
+
LoggingConfiguration.new(logger: logger, log_level: log_level,
|
109
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
110
|
+
request_logging_config: request_logging_config,
|
111
|
+
response_logging_config: response_logging_config)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# words_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WordsApi
|
7
|
+
# Represents the generic logger facade
|
8
|
+
class AbstractLogger < Logger
|
9
|
+
# Logs a message with a specified log level and additional parameters.
|
10
|
+
# @param level [Symbol] The log level of the message.
|
11
|
+
# @param message [String] The message to log.
|
12
|
+
# @param params [Hash] Additional parameters to include in the log message.
|
13
|
+
def log(level, message, params)
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/words_api.rb
CHANGED
@@ -24,6 +24,8 @@ require_relative 'words_api/http/http_request'
|
|
24
24
|
require_relative 'words_api/http/http_response'
|
25
25
|
|
26
26
|
# Logger
|
27
|
+
require_relative 'words_api/logging/configuration/api_logging_configuration'
|
28
|
+
require_relative 'words_api/logging/sdk_logger'
|
27
29
|
require_relative 'words_api/http/auth/custom_header_authentication'
|
28
30
|
|
29
31
|
# Models
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-words-api-client-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sufyan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -103,6 +103,8 @@ files:
|
|
103
103
|
- lib/words_api/http/http_method_enum.rb
|
104
104
|
- lib/words_api/http/http_request.rb
|
105
105
|
- lib/words_api/http/http_response.rb
|
106
|
+
- lib/words_api/logging/configuration/api_logging_configuration.rb
|
107
|
+
- lib/words_api/logging/sdk_logger.rb
|
106
108
|
- lib/words_api/models/base_model.rb
|
107
109
|
- lib/words_api/models/definitions_response.rb
|
108
110
|
- lib/words_api/models/examples_response.rb
|