apimatic_core_interfaces 0.2.1 → 0.2.3

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: 01a4e34ebafdba39e2611a2b683cd55dfc9e28d1ba990680b247e82e0258eebb
4
- data.tar.gz: 100242792ff4890d5a68fd9ec72dea9027583630b42db0791156cb26cc88dcb6
3
+ metadata.gz: 3c5d0795887af96ba2d6a9a3a437618db88c66f6f57e5fcaca3abba3cf921614
4
+ data.tar.gz: 472e084106a9ebbd4c8b890942436a81ffbc4d31e66519a8a71e6b85ec58f6ab
5
5
  SHA512:
6
- metadata.gz: 416839b0980056003f53c6a9329edd837ffb7c4ce0e01cd8a5580a9e19fcb142c76a14dd77b082fbc6741167fe92a62f166902d77fae1b46710c2089d93871fc
7
- data.tar.gz: 9b056e3bde0d308e524b526b597d32e0289c3ad3594f5f070479b80ad782d7905f31eac1b25a6833c1a9079f892eedf761dda0d0ad3cef8b3d4a07b6fca34337
6
+ metadata.gz: 0be1aef9668c195e9ed7b74230069e0219d59289f44539fd7c1509b5fede2cd44420968cdb97557a973efb9fe83aa7d713e04ccb023f66b9f39be4359943a515
7
+ data.tar.gz: 3090e6693b1ab3a45394c5d0482442c5264e66ecbb76b1527e7900e785258c40989302915df3d2de6ca365e1b0cc030f20e1a374d762aa77812b7295f12a6db2
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/apimatic_core_interfaces.svg)](https://badge.fury.io/rb/apimatic_core_interfaces)
4
4
  [![Linting][lint-badge]][lint-url]
5
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
6
- [![Maintainability][maintainability-url]][code-climate-url]
6
+ [![Maintainability Rating][maintainability-badge]][maintainability-url]
7
+ [![Vulnerabilities][vulnerabilities-badge]][vulnerabilities-url]
7
8
  [![Licence][license-badge]][license-url]
8
9
 
9
10
  ## Introduction
@@ -24,26 +25,33 @@ gem 'apimatic_core_interfaces'
24
25
  ```
25
26
 
26
27
  ## Interfaces
27
- | Name | Description |
28
- |--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
29
- | [`HttpClient`](lib/apimatic-core-interfaces/client/http_client.rb) | To save both Request and Response after the completion of response |
30
- | [`ResponseFactory`](lib/apimatic-core-interfaces/factories/response_factory.rb) | To convert the client-adapter response into a custom HTTP response |
31
- | [`Authentication`](lib/apimatic-core-interfaces/types/authentication.rb) | To setup methods for the validation and application of the required authentication scheme |
32
- | [`UnionType`](lib/apimatic-core-interfaces/types/union_type.rb) | To setup methods for the validation, serialization and deserialization of OneOf/AnyOf union types |
33
- | [`ApiLogger`](lib/apimatic-core-interfaces/logger/api_logger.rb) | An interface for logging API requests and responses. |
34
- | [`Logger`](lib/apimatic-core-interfaces/logger/logger.rb) | An interface for the generic logger facade |
35
-
28
+ | Name | Description |
29
+ |------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
30
+ | [`HttpClient`](lib/apimatic-core-interfaces/client/http_client.rb) | To save both Request and Response after the completion of response |
31
+ | [`ResponseFactory`](lib/apimatic-core-interfaces/factories/response_factory.rb) | To convert the client-adapter response into a custom HTTP response |
32
+ | [`Authentication`](lib/apimatic-core-interfaces/types/authentication.rb) | To setup methods for the validation and application of the required authentication scheme |
33
+ | [`UnionType`](lib/apimatic-core-interfaces/types/union_type.rb) | To setup methods for the validation, serialization and deserialization of OneOf/AnyOf union types |
34
+ | [`ApiLogger`](lib/apimatic-core-interfaces/logger/api_logger.rb) | An interface for logging API requests and responses. |
35
+ | [`Logger`](lib/apimatic-core-interfaces/logger/logger.rb) | An interface for the generic logger facade |
36
+ | [`SignatureVerifier`](lib/apimatic-core-interfaces/security/signature_verifier.rb) | Interface for verifying webhook event authenticity. |
37
+
38
+ ## Types
39
+ | Name | Description |
40
+ |------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
41
+ | [`SignatureVerificationResult`](lib/apimatic-core-interfaces/types/signature_verification_result.rb) | Model representing the outcome of signature verification (success or failure with errors). |
36
42
 
37
43
  ## Enumerations
38
- | Name | Description |
39
- |------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
40
- | [`DateTimeFormat`](lib/apimatic-core-interfaces/types/datetime_format.rb) | Enumeration containing different datetime formats (RFC1123, RFC3339, UNIX_TIMESTAMP) |
41
- | [`HttpMethod`](lib/apimatic-core-interfaces/types/http_method.rb) | Enumeration containing HTTP Methods (GET, PUT, POST, PATCH, DELETE, HEAD) |
42
- | [`ArraySerializationFormat`](lib/apimatic-core-interfaces/types/array_serialization_format.rb) | Enumeration containing different array serialization formats (INDEXED, UNINDEXED, PLAIN, CSV, PSV, TSV) |
44
+ | Name | Description |
45
+ |------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
46
+ | [`DateTimeFormat`](lib/apimatic-core-interfaces/types/datetime_format.rb) | Enumeration containing different datetime formats (RFC1123, RFC3339, UNIX_TIMESTAMP) |
47
+ | [`HttpMethod`](lib/apimatic-core-interfaces/types/http_method.rb) | Enumeration containing HTTP Methods (GET, PUT, POST, PATCH, DELETE, HEAD) |
48
+ | [`ArraySerializationFormat`](lib/apimatic-core-interfaces/types/array_serialization_format.rb) | Enumeration containing different array serialization formats (INDEXED, UNINDEXED, PLAIN, CSV, PSV, TSV) |
43
49
 
44
50
  [lint-badge]: https://github.com/apimatic/core-interfaces-ruby/actions/workflows/lint-runner.yml/badge.svg
45
51
  [lint-url]: https://github.com/apimatic/core-interfaces-ruby/actions/workflows/lint-runner.yml
46
- [code-climate-url]: https://codeclimate.com/github/apimatic/core-interfaces-ruby
47
- [maintainability-url]: https://api.codeclimate.com/v1/badges/6557a25e71f7e97e4bb5/maintainability
52
+ [maintainability-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-interfaces-ruby&metric=sqale_rating
53
+ [maintainability-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-interfaces-ruby
54
+ [vulnerabilities-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-interfaces-ruby&metric=vulnerabilities
55
+ [vulnerabilities-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-interfaces-ruby
48
56
  [license-badge]: https://img.shields.io/badge/licence-MIT-blue
49
57
  [license-url]: LICENSE
@@ -4,6 +4,7 @@ module CoreLibrary
4
4
  # for HTTP Client Configuration class.
5
5
  class ClientConfiguration
6
6
  attr_reader :timeout, :max_retries, :retry_interval, :backoff_factor, :retry_statuses,
7
- :retry_methods, :connection, :adapter, :response_factory, :cache, :verify
7
+ :retry_methods, :connection, :adapter, :response_factory, :cache, :verify,
8
+ :proxy_settings
8
9
  end
9
10
  end
@@ -0,0 +1,19 @@
1
+ module CoreLibrary
2
+ # An interface for signature verification.
3
+ # This class should not be instantiated but used as a base class for
4
+ # implementing signature verification logic.
5
+ class SignatureVerifier
6
+ # Verifies the signature of the given HTTP request.
7
+ #
8
+ # @param request [Rack::Request] The rack request to verify.
9
+ # @return [CoreLibrary::SignatureVerificationResult] The result of signature verification.
10
+ #
11
+ # Notes:
12
+ # Implementations should not raise exceptions for runtime verification failures.
13
+ # Instead, return `SignatureVerificationResult.failed(error)`.
14
+ # Raising should be reserved for programmer errors (e.g., misconfiguration).
15
+ def verify(request)
16
+ raise NotImplementedError, 'This method must be implemented in a subclass.'
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ module CoreLibrary
2
+ # Represents the result of signature verification.
3
+ class SignatureVerificationResult
4
+ # Outcome of signature verification.
5
+ # Attributes:
6
+ # ok: true if the signature verification passed.
7
+ # errors: list of error messages raised by the verifier. nil when ok is true.
8
+
9
+ attr_reader :ok, :errors
10
+
11
+ def initialize(ok:, errors: nil)
12
+ @ok = ok
13
+ @errors = errors
14
+ end
15
+
16
+ def self.passed
17
+ new(ok: true)
18
+ end
19
+
20
+ def self.failed(errors = nil)
21
+ new(ok: false, errors: errors)
22
+ end
23
+ end
24
+ end
@@ -6,9 +6,12 @@ require_relative 'apimatic-core-interfaces/factories/response_factory'
6
6
  require_relative 'apimatic-core-interfaces/logger/logger'
7
7
  require_relative 'apimatic-core-interfaces/logger/api_logger'
8
8
 
9
+ require_relative 'apimatic-core-interfaces/security/signature_verifier'
10
+
9
11
  require_relative 'apimatic-core-interfaces/types/authentication'
10
12
  require_relative 'apimatic-core-interfaces/types/union_type'
11
13
  require_relative 'apimatic-core-interfaces/types/http_callback'
12
14
  require_relative 'apimatic-core-interfaces/types/http_method'
13
15
  require_relative 'apimatic-core-interfaces/types/array_serialization_format'
14
16
  require_relative 'apimatic-core-interfaces/types/datetime_format'
17
+ require_relative 'apimatic-core-interfaces/types/signature_verification_result'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core_interfaces
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2025-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This project contains the abstract layer for APIMatic's core library.
14
14
  The purpose of creating interfaces is to separate out the functionalities needed
@@ -27,18 +27,20 @@ files:
27
27
  - lib/apimatic-core-interfaces/factories/response_factory.rb
28
28
  - lib/apimatic-core-interfaces/logger/api_logger.rb
29
29
  - lib/apimatic-core-interfaces/logger/logger.rb
30
+ - lib/apimatic-core-interfaces/security/signature_verifier.rb
30
31
  - lib/apimatic-core-interfaces/types/array_serialization_format.rb
31
32
  - lib/apimatic-core-interfaces/types/authentication.rb
32
33
  - lib/apimatic-core-interfaces/types/datetime_format.rb
33
34
  - lib/apimatic-core-interfaces/types/http_callback.rb
34
35
  - lib/apimatic-core-interfaces/types/http_method.rb
36
+ - lib/apimatic-core-interfaces/types/signature_verification_result.rb
35
37
  - lib/apimatic-core-interfaces/types/union_type.rb
36
38
  - lib/apimatic_core_interfaces.rb
37
39
  homepage: https://apimatic.io
38
40
  licenses:
39
41
  - MIT
40
42
  metadata: {}
41
- post_install_message:
43
+ post_install_message:
42
44
  rdoc_options: []
43
45
  require_paths:
44
46
  - lib
@@ -54,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
56
  version: '0'
55
57
  requirements: []
56
58
  rubygems_version: 3.4.19
57
- signing_key:
59
+ signing_key:
58
60
  specification_version: 4
59
61
  summary: An abstract layer of the functionalities provided by apimatic-core, faraday-client-adapter
60
62
  and APIMatic SDKs.