apimatic_core_interfaces 0.2.2 → 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: bb1641a899a871a9ce535ef8f0067428fadfeef40a4225caf6e2888f4efe2bba
4
- data.tar.gz: 96cea708ad59e88a0d2f3058a2411718032fd1d68528ee374755b93f4fb90fe4
3
+ metadata.gz: 3c5d0795887af96ba2d6a9a3a437618db88c66f6f57e5fcaca3abba3cf921614
4
+ data.tar.gz: 472e084106a9ebbd4c8b890942436a81ffbc4d31e66519a8a71e6b85ec58f6ab
5
5
  SHA512:
6
- metadata.gz: 1c8ef44909e9ad1bd2b9fa303610b4b0850355b5d15f31544255fcc0857b8ba02115f36ca99d06fdbda44af94d53b2bb4aa99d46a75512c97e6f0734c3f1acb7
7
- data.tar.gz: 831893359497ca2843612c9d3ff6b31b867e282e0c1483b4b145986963e9dd623157e3b82eb925a7a33e4debcc4539003a5d04997e67a1add8dbdb45453e5d9e
6
+ metadata.gz: 0be1aef9668c195e9ed7b74230069e0219d59289f44539fd7c1509b5fede2cd44420968cdb97557a973efb9fe83aa7d713e04ccb023f66b9f39be4359943a515
7
+ data.tar.gz: 3090e6693b1ab3a45394c5d0482442c5264e66ecbb76b1527e7900e785258c40989302915df3d2de6ca365e1b0cc030f20e1a374d762aa77812b7295f12a6db2
data/README.md CHANGED
@@ -25,22 +25,27 @@ gem 'apimatic_core_interfaces'
25
25
  ```
26
26
 
27
27
  ## Interfaces
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
-
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). |
37
42
 
38
43
  ## Enumerations
39
- | Name | Description |
40
- |------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
41
- | [`DateTimeFormat`](lib/apimatic-core-interfaces/types/datetime_format.rb) | Enumeration containing different datetime formats (RFC1123, RFC3339, UNIX_TIMESTAMP) |
42
- | [`HttpMethod`](lib/apimatic-core-interfaces/types/http_method.rb) | Enumeration containing HTTP Methods (GET, PUT, POST, PATCH, DELETE, HEAD) |
43
- | [`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) |
44
49
 
45
50
  [lint-badge]: https://github.com/apimatic/core-interfaces-ruby/actions/workflows/lint-runner.yml/badge.svg
46
51
  [lint-url]: https://github.com/apimatic/core-interfaces-ruby/actions/workflows/lint-runner.yml
@@ -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.2
4
+ version: 0.2.3
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-12 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,11 +27,13 @@ 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