wesley-key-sdk 4.2.0 → 4.3.1

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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -47
  3. data/bin/console +4 -4
  4. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/api_helper.rb +2 -2
  5. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/apis/base_api.rb +3 -3
  6. data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
  7. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/client.rb +15 -34
  8. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/configuration.rb +20 -30
  9. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
  10. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
  11. data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
  12. data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
  13. data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
  14. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
  15. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
  16. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
  17. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
  18. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
  19. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/exceptions/api_exception.rb +2 -2
  20. data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
  21. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/api_response.rb +2 -2
  22. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/auth/api_key.rb +15 -15
  23. data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
  24. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_call_back.rb +2 -2
  25. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_method_enum.rb +2 -2
  26. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_request.rb +2 -2
  27. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_response.rb +2 -2
  28. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/proxy_settings.rb +2 -2
  29. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/configuration/api_logging_configuration.rb +2 -2
  30. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/sdk_logger.rb +2 -2
  31. data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
  32. data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
  33. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/models/base_model.rb +2 -2
  34. data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
  35. data/lib/{swagger_petstore_open_api30/models/tag.rb → webhooks_and_callbacks_api/models/delivery_details.rb} +35 -36
  36. data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
  37. data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
  38. data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
  39. data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
  40. data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
  41. data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
  42. data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
  43. data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
  44. data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
  45. data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
  46. data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
  47. data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
  48. data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
  49. data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +44 -0
  50. data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
  51. data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
  52. data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
  53. data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
  54. data/lib/{swagger_petstore_open_api30/models/category.rb → webhooks_and_callbacks_api/models/package.rb} +29 -39
  55. data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
  56. data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
  57. data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
  58. data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
  59. data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
  60. data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
  61. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
  62. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
  63. data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
  64. data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
  65. data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
  66. data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
  67. data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
  68. data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
  69. data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
  70. data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
  71. data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
  72. data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
  73. data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
  74. data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
  75. data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
  76. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/date_time_helper.rb +2 -2
  77. data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +2 -2
  78. data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
  79. data/lib/webhooks_and_callbacks_api.rb +122 -0
  80. metadata +78 -37
  81. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +0 -287
  82. data/lib/swagger_petstore_open_api30/apis/store_api.rb +0 -131
  83. data/lib/swagger_petstore_open_api30/apis/user_api.rb +0 -233
  84. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +0 -64
  85. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +0 -112
  86. data/lib/swagger_petstore_open_api30/models/api_response.rb +0 -118
  87. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +0 -62
  88. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +0 -36
  89. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +0 -125
  90. data/lib/swagger_petstore_open_api30/models/order.rb +0 -167
  91. data/lib/swagger_petstore_open_api30/models/order_status.rb +0 -40
  92. data/lib/swagger_petstore_open_api30/models/pet.rb +0 -168
  93. data/lib/swagger_petstore_open_api30/models/pet_status.rb +0 -40
  94. data/lib/swagger_petstore_open_api30/models/user.rb +0 -182
  95. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +0 -12
  96. data/lib/swagger_petstore_open_api30.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f22b22395a8452f239db0c529bcd4bd9c4d209bc42dece0aa51ccda0794bf274
4
- data.tar.gz: 646a929e08b140f97c9ff50c7aa9e052d087e5880f5b13b0f045d84dfa6a4bb4
3
+ metadata.gz: 652b3d8c0bcd744134cd8fd75b9f16e6b8a8839fcaf4157bac5cb623cbb0920d
4
+ data.tar.gz: 8766ff7d24d3165448c491b1ef34683d1eed1bfcb5d30badc45e9f5f56b6b1d4
5
5
  SHA512:
6
- metadata.gz: 8b841fcc3575323415331051808a172ab7b2f10380c9292190d122a6912b6e68ab655654905faa41949e252c2b1aa9ba9923146dab8c32bb85eb24b8cee1d241
7
- data.tar.gz: e7865b424ea16c05604c1ed249dcc4665279c35b890ea60736597b6c0476889121b9a662e67f40956192fc8e372c496fe1920e43ddf75cf1e0101462a53783bd
6
+ metadata.gz: 310f1ef0edc523114ee0c04fe3bce8ef3d6cbcfaf3dba7a20211d8d58fce1b7e7e7a4c10cb8b634d0a055e7516a5464e1b0620b2e3385d48b9919db98e6a2824
7
+ data.tar.gz: c20f2ee17ab64d19ce313cfcf50f110461c4cc619638d0c433ff1d8f152da3abe0dc82dc6c8509bf6ead3ab33be2da7048bef3efc55f25b8d8f92797d9dcdac2
data/README.md CHANGED
@@ -1,35 +1,33 @@
1
1
 
2
- # Getting Started with Swagger Petstore - OpenAPI 3.0
2
+ # Getting Started with Webhooks and Callbacks API
3
3
 
4
4
  ## Introduction
5
5
 
6
- This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
7
- Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
8
- You can now help us improve the API whether it's by making changes to the definition itself or to the code.
9
- That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
6
+ A comprehensive API demonstrating webhooks and callbacks patterns.
10
7
 
11
- Some useful links:
8
+ ### Webhooks
12
9
 
13
- - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
14
- - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
10
+ Webhooks allow your application to receive real-time notifications when certain events occur.
15
11
 
16
- Find out more about Swagger: [https://swagger.io](https://swagger.io)
12
+ ### Callbacks
13
+
14
+ Callbacks are used for asynchronous operations where the API will call back to your provided URL when the operation completes.
17
15
 
18
16
  ## Install the Package
19
17
 
20
18
  Install the gem from the command line:
21
19
 
22
20
  ```bash
23
- gem install wesley-key-sdk -v 4.2.0
21
+ gem install wesley-key-sdk -v 4.3.1
24
22
  ```
25
23
 
26
24
  Or add the gem to your Gemfile and run `bundle`:
27
25
 
28
26
  ```ruby
29
- gem 'wesley-key-sdk', '4.2.0'
27
+ gem 'wesley-key-sdk', '4.3.1'
30
28
  ```
31
29
 
32
- For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/4.2.0).
30
+ For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/4.3.1).
33
31
 
34
32
  ## IRB Console Usage
35
33
 
@@ -46,8 +44,8 @@ irb
46
44
  Now you can load the SDK in the IRB
47
45
 
48
46
  ```ruby
49
- require 'swagger_petstore_open_api30'
50
- include SwaggerPetstoreOpenApi30
47
+ require 'webhooks_and_callbacks_api'
48
+ include WebhooksAndCallbacksApi
51
49
  ```
52
50
 
53
51
  ### 2. Use IRB within SDK
@@ -55,7 +53,7 @@ include SwaggerPetstoreOpenApi30
55
53
  Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
56
54
 
57
55
  ```
58
- cd path/to/swagger_petstore_open_api30
56
+ cd path/to/webhooks_and_callbacks_api
59
57
  ```
60
58
 
61
59
  Now you can start the preconfigured irb console by running the following command
@@ -74,10 +72,9 @@ The following parameters are configurable for the API Client:
74
72
 
75
73
  | Parameter | Type | Description |
76
74
  | --- | --- | --- |
77
- | environment | [`Environment`](README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
78
75
  | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
79
76
  | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
80
- | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
77
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 50** |
81
78
  | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
82
79
  | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
83
80
  | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
@@ -86,30 +83,24 @@ The following parameters are configurable for the API Client:
86
83
  | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
87
84
  | proxy_settings | [`ProxySettings`](doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
88
85
  | logging_configuration | [`LoggingConfiguration`](doc/logging-configuration.md) | The SDK logging configuration for API calls |
89
- | petstore_auth_credentials | [`PetstoreAuthCredentials`](doc/auth/oauth-2-implicit-grant.md) | The credential object for OAuth 2 Implicit Grant |
90
86
  | api_key_credentials | [`ApiKeyCredentials`](doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
87
+ | bearer_auth_credentials | [`BearerAuthCredentials`](doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
91
88
 
92
89
  The API client can be initialized as follows:
93
90
 
94
91
  ### Code-Based Client Initialization
95
92
 
96
93
  ```ruby
97
- require 'swagger_petstore_open_api30'
98
- include SwaggerPetstoreOpenApi30
94
+ require 'webhooks_and_callbacks_api'
95
+ include WebhooksAndCallbacksApi
99
96
 
100
97
  client = Client.new(
101
- petstore_auth_credentials: PetstoreAuthCredentials.new(
102
- oauth_client_id: 'OAuthClientId',
103
- oauth_redirect_uri: 'OAuthRedirectUri',
104
- oauth_scopes: [
105
- OauthScopePetstoreAuth::WRITEPETS,
106
- OauthScopePetstoreAuth::READPETS
107
- ]
108
- ),
109
98
  api_key_credentials: ApiKeyCredentials.new(
110
- api_key: 'api_key'
99
+ x_api_key: 'X-API-Key'
100
+ ),
101
+ bearer_auth_credentials: BearerAuthCredentials.new(
102
+ access_token: 'AccessToken'
111
103
  ),
112
- environment: Environment::PRODUCTION,
113
104
  logging_configuration: LoggingConfiguration.new(
114
105
  log_level: Logger::INFO,
115
106
  request_logging_config: RequestLoggingConfiguration.new(
@@ -125,8 +116,8 @@ client = Client.new(
125
116
  ### Environment-Based Client Initialization
126
117
 
127
118
  ```ruby
128
- require 'swagger_petstore_open_api30'
129
- include SwaggerPetstoreOpenApi30
119
+ require 'webhooks_and_callbacks_api'
120
+ include WebhooksAndCallbacksApi
130
121
 
131
122
  # Create client from environment
132
123
  client = Client.from_env
@@ -134,28 +125,24 @@ client = Client.from_env
134
125
 
135
126
  See the [`Environment-Based Client Initialization`](doc/environment-based-client-initialization.md) section for details.
136
127
 
137
- ## Environments
138
-
139
- The SDK can be configured to use a different environment for making API calls. Available environments are:
140
-
141
- ### Fields
142
-
143
- | Name | Description |
144
- | --- | --- |
145
- | PRODUCTION | **Default** |
146
-
147
128
  ## Authorization
148
129
 
149
130
  This API uses the following authentication schemes.
150
131
 
151
- * [`petstore_auth (OAuth 2 Implicit Grant)`](doc/auth/oauth-2-implicit-grant.md)
152
- * [`api_key (Custom Header Signature)`](doc/auth/custom-header-signature.md)
132
+ * [`ApiKey (Custom Header Signature)`](doc/auth/custom-header-signature.md)
133
+ * [`BearerAuth (OAuth 2 Bearer token)`](doc/auth/oauth-2-bearer-token.md)
153
134
 
154
135
  ## List of APIs
155
136
 
156
- * [Pet](doc/controllers/pet.md)
157
- * [Store](doc/controllers/store.md)
158
- * [User](doc/controllers/user.md)
137
+ * [Orders](doc/controllers/orders.md)
138
+
139
+ ## Webhooks
140
+
141
+ * [Webhooks](doc/events/webhooks/webhooks-handler.md)
142
+ * [Webhooks A](doc/events/webhooks/webhooks-a-handler.md)
143
+ * [Webhooks B](doc/events/webhooks/webhooks-b-handler.md)
144
+ * [Webhooks C](doc/events/webhooks/webhooks-c-handler.md)
145
+ * [Webhooks No Verification](doc/events/webhooks/webhooks-no-verification-handler.md)
159
146
 
160
147
  ## SDK Infrastructure
161
148
 
data/bin/console CHANGED
@@ -4,11 +4,11 @@
4
4
  $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
5
 
6
6
  # Require the gem
7
- require 'swagger_petstore_open_api30'
7
+ require 'webhooks_and_callbacks_api'
8
8
 
9
- puts 'SwaggerPetstoreOpenApi30 SDK loaded!'
10
- puts 'You can now create a client with: client = SwaggerPetstoreOpenApi30::Client.new'
11
- puts 'Or use from_env: client = SwaggerPetstoreOpenApi30::Client.from_env'
9
+ puts 'WebhooksAndCallbacksApi SDK loaded!'
10
+ puts 'You can now create a client with: client = WebhooksAndCallbacksApi::Client.new'
11
+ puts 'Or use from_env: client = WebhooksAndCallbacksApi::Client.from_env'
12
12
 
13
13
  # Start an interactive IRB session
14
14
  require 'irb'
@@ -1,9 +1,9 @@
1
- # swagger_petstore_open_api30
1
+ # webhooks_and_callbacks_api
2
2
  #
3
3
  # This file was automatically generated by
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
- module SwaggerPetstoreOpenApi30
6
+ module WebhooksAndCallbacksApi
7
7
  # API utility class
8
8
  class APIHelper < CoreLibrary::ApiHelper
9
9
  end
@@ -1,16 +1,16 @@
1
- # swagger_petstore_open_api30
1
+ # webhooks_and_callbacks_api
2
2
  #
3
3
  # This file was automatically generated by
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
- module SwaggerPetstoreOpenApi30
6
+ module WebhooksAndCallbacksApi
7
7
  # BaseApi.
8
8
  class BaseApi
9
9
  include CoreLibrary
10
10
  attr_accessor :config, :http_call_back
11
11
 
12
12
  def self.user_agent
13
- 'Ruby-SDK/4.2.0 (OS: {os-info}, Engine: {engine}/{engine-version})'
13
+ 'Ruby-SDK/4.3.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
14
  end
15
15
 
16
16
  def self.user_agent_parameters
@@ -0,0 +1,34 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # OrdersApi
8
+ class OrdersApi < BaseApi
9
+ # Creates a new order and triggers callbacks for payment processing
10
+ # @param [CreateOrderRequest] body Required parameter: TODO: type
11
+ # description here
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def create_order(body)
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/orders',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
19
+ .body_param(new_parameter(body)
20
+ .is_required(true))
21
+ .header_param(new_parameter('application/json', key: 'accept'))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Or.new('ApiKey', 'BearerAuth')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(Order.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('400',
29
+ 'Invalid request',
30
+ ErrorException))
31
+ .execute
32
+ end
33
+ end
34
+ end
@@ -1,10 +1,10 @@
1
- # swagger_petstore_open_api30
1
+ # webhooks_and_callbacks_api
2
2
  #
3
3
  # This file was automatically generated by
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
- module SwaggerPetstoreOpenApi30
7
- # swagger_petstore_open_api30 client class.
6
+ module WebhooksAndCallbacksApi
7
+ # webhooks_and_callbacks_api client class.
8
8
  class Client
9
9
  include CoreLibrary
10
10
  attr_reader :config, :auth_managers
@@ -12,38 +12,21 @@ module SwaggerPetstoreOpenApi30
12
12
  def user_agent_detail
13
13
  config.user_agent_detail
14
14
  end
15
-
16
- # Returns the configured authentication petstore_auth instance.
17
- def petstore_auth
18
- @auth_managers['petstore_auth']
19
- end
20
-
21
- # Access to pet controller.
22
- # @return [PetApi] Returns the controller instance.
23
- def pet
24
- @pet ||= PetApi.new @global_configuration
25
- end
26
-
27
- # Access to store controller.
28
- # @return [StoreApi] Returns the controller instance.
29
- def store
30
- @store ||= StoreApi.new @global_configuration
31
- end
32
15
 
33
- # Access to user controller.
34
- # @return [UserApi] Returns the controller instance.
35
- def user
36
- @user ||= UserApi.new @global_configuration
16
+ # Access to orders controller.
17
+ # @return [OrdersApi] Returns the controller instance.
18
+ def orders
19
+ @orders ||= OrdersApi.new @global_configuration
37
20
  end
38
21
 
39
22
  def initialize(
40
- connection: nil, adapter: :net_http_persistent, timeout: 30,
23
+ connection: nil, adapter: :net_http_persistent, timeout: 50,
41
24
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
42
25
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
43
26
  retry_methods: %i[get put get put], http_callback: nil,
44
27
  proxy_settings: nil, logging_configuration: nil,
45
- environment: Environment::PRODUCTION, petstore_auth_credentials: nil,
46
- api_key_credentials: nil, config: nil
28
+ environment: Environment::PRODUCTION, api_key_credentials: nil,
29
+ bearer_auth_credentials: nil, config: nil
47
30
  )
48
31
  @config = if config.nil?
49
32
  Configuration.new(
@@ -55,8 +38,8 @@ module SwaggerPetstoreOpenApi30
55
38
  proxy_settings: proxy_settings,
56
39
  logging_configuration: logging_configuration,
57
40
  environment: environment,
58
- petstore_auth_credentials: petstore_auth_credentials,
59
- api_key_credentials: api_key_credentials
41
+ api_key_credentials: api_key_credentials,
42
+ bearer_auth_credentials: bearer_auth_credentials
60
43
  )
61
44
  else
62
45
  config
@@ -78,11 +61,9 @@ module SwaggerPetstoreOpenApi30
78
61
  def initialize_auth_managers(global_config)
79
62
  @auth_managers = {}
80
63
  http_client_config = global_config.client_configuration
81
- %w[petstore_auth api_key].each { |auth| @auth_managers[auth] = nil }
82
- @auth_managers['petstore_auth'] = PetstoreAuth.new(
83
- http_client_config.petstore_auth_credentials, global_config
84
- )
85
- @auth_managers['api_key'] = ApiKey.new(http_client_config.api_key_credentials)
64
+ %w[ApiKey BearerAuth].each { |auth| @auth_managers[auth] = nil }
65
+ @auth_managers['ApiKey'] = ApiKey.new(http_client_config.api_key_credentials)
66
+ @auth_managers['BearerAuth'] = BearerAuth.new(http_client_config.bearer_auth_credentials)
86
67
  end
87
68
 
88
69
  # Creates a client directly from environment variables.
@@ -1,9 +1,9 @@
1
- # swagger_petstore_open_api30
1
+ # webhooks_and_callbacks_api
2
2
  #
3
3
  # This file was automatically generated by
4
4
  # APIMATIC v3.0 ( https://www.apimatic.io ).
5
5
 
6
- module SwaggerPetstoreOpenApi30
6
+ module WebhooksAndCallbacksApi
7
7
  # An enum for SDK environments.
8
8
  class Environment
9
9
  ENVIRONMENT = [
@@ -21,23 +21,14 @@ module SwaggerPetstoreOpenApi30
21
21
  # An enum for API servers.
22
22
  class Server
23
23
  SERVER = [
24
- DEFAULT = 'default'.freeze,
25
- AUTH_SERVER = 'auth server'.freeze
24
+ DEFAULT = 'default'.freeze
26
25
  ].freeze
27
26
 
28
27
  # Converts a string or symbol into a valid Server constant.
29
28
  def self.from_value(value, default_value = DEFAULT)
30
29
  return default_value if value.nil?
31
30
 
32
- str = value.to_s.strip.downcase
33
- case str
34
- when 'default' then DEFAULT
35
- when 'auth_server' then AUTH_SERVER
36
-
37
- else
38
- warn "[Server] Unknown server '#{value}', falling back to #{default_value} "
39
- default_value
40
- end
31
+ default_value
41
32
  end
42
33
  end
43
34
 
@@ -45,20 +36,20 @@ module SwaggerPetstoreOpenApi30
45
36
  # are configured in this class.
46
37
  class Configuration < CoreLibrary::HttpClientConfiguration
47
38
  # The attribute readers for properties.
48
- attr_reader :environment, :petstore_auth_credentials, :api_key_credentials
39
+ attr_reader :environment, :api_key_credentials, :bearer_auth_credentials
49
40
 
50
41
  class << self
51
42
  attr_reader :environments
52
43
  end
53
44
 
54
45
  def initialize(
55
- connection: nil, adapter: :net_http_persistent, timeout: 30,
46
+ connection: nil, adapter: :net_http_persistent, timeout: 50,
56
47
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
57
48
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
58
49
  retry_methods: %i[get put get put], http_callback: nil,
59
50
  proxy_settings: nil, logging_configuration: nil,
60
- environment: Environment::PRODUCTION, petstore_auth_credentials: nil,
61
- api_key_credentials: nil
51
+ environment: Environment::PRODUCTION, api_key_credentials: nil,
52
+ bearer_auth_credentials: nil
62
53
  )
63
54
  super connection: connection, adapter: adapter, timeout: timeout,
64
55
  max_retries: max_retries, retry_interval: retry_interval,
@@ -70,12 +61,12 @@ module SwaggerPetstoreOpenApi30
70
61
  # Current API environment
71
62
  @environment = String(environment)
72
63
 
73
- # The object holding OAuth 2 Implicit Grant credentials
74
- @petstore_auth_credentials = petstore_auth_credentials
75
-
76
64
  # The object holding Custom Header Signature credentials
77
65
  @api_key_credentials = api_key_credentials
78
66
 
67
+ # The object holding OAuth 2 Bearer token credentials
68
+ @bearer_auth_credentials = bearer_auth_credentials
69
+
79
70
  # The Http Client to use for making requests.
80
71
  set_http_client CoreLibrary::FaradayClient.new(self)
81
72
  end
@@ -84,8 +75,8 @@ module SwaggerPetstoreOpenApi30
84
75
  max_retries: nil, retry_interval: nil, backoff_factor: nil,
85
76
  retry_statuses: nil, retry_methods: nil, http_callback: nil,
86
77
  proxy_settings: nil, logging_configuration: nil,
87
- environment: nil, petstore_auth_credentials: nil,
88
- api_key_credentials: nil)
78
+ environment: nil, api_key_credentials: nil,
79
+ bearer_auth_credentials: nil)
89
80
  connection ||= self.connection
90
81
  adapter ||= self.adapter
91
82
  timeout ||= self.timeout
@@ -98,8 +89,8 @@ module SwaggerPetstoreOpenApi30
98
89
  proxy_settings ||= self.proxy_settings
99
90
  logging_configuration ||= self.logging_configuration
100
91
  environment ||= self.environment
101
- petstore_auth_credentials ||= self.petstore_auth_credentials
102
92
  api_key_credentials ||= self.api_key_credentials
93
+ bearer_auth_credentials ||= self.bearer_auth_credentials
103
94
 
104
95
  Configuration.new(connection: connection, adapter: adapter,
105
96
  timeout: timeout, max_retries: max_retries,
@@ -111,16 +102,15 @@ module SwaggerPetstoreOpenApi30
111
102
  proxy_settings: proxy_settings,
112
103
  logging_configuration: logging_configuration,
113
104
  environment: environment,
114
- petstore_auth_credentials: petstore_auth_credentials,
115
- api_key_credentials: api_key_credentials)
105
+ api_key_credentials: api_key_credentials,
106
+ bearer_auth_credentials: bearer_auth_credentials)
116
107
  end
117
108
 
118
109
 
119
110
  # All the environments the SDK can run in.
120
111
  ENVIRONMENTS = {
121
112
  Environment::PRODUCTION => {
122
- Server::DEFAULT => 'https://petstore3.swagger.io/api/v3',
123
- Server::AUTH_SERVER => 'https://petstore3.swagger.io/oauth'
113
+ Server::DEFAULT => 'http://localhost:3000/callbacks'
124
114
  }
125
115
  }.freeze
126
116
 
@@ -136,7 +126,7 @@ module SwaggerPetstoreOpenApi30
136
126
  def self.build_default_config_from_env
137
127
  # === Core environment ===
138
128
  environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
139
- timeout = (ENV['TIMEOUT'] || 30).to_f
129
+ timeout = (ENV['TIMEOUT'] || 50).to_f
140
130
  max_retries = (ENV['MAX_RETRIES'] || 0).to_i
141
131
  retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
142
132
  backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
@@ -155,8 +145,8 @@ module SwaggerPetstoreOpenApi30
155
145
  end
156
146
 
157
147
  # === Authentication credentials ===
158
- petstore_auth_credentials = PetstoreAuthCredentials.from_env
159
148
  api_key_credentials = ApiKeyCredentials.from_env
149
+ bearer_auth_credentials = BearerAuthCredentials.from_env
160
150
 
161
151
  # === Proxy settings ===
162
152
  proxy_settings = ProxySettings.from_env
@@ -171,8 +161,8 @@ module SwaggerPetstoreOpenApi30
171
161
  backoff_factor: backoff_factor,
172
162
  retry_statuses: retry_statuses,
173
163
  retry_methods: retry_methods,
174
- petstore_auth_credentials: petstore_auth_credentials,
175
164
  api_key_credentials: api_key_credentials,
165
+ bearer_auth_credentials: bearer_auth_credentials,
176
166
  proxy_settings: proxy_settings,
177
167
  logging_configuration: logging_configuration
178
168
  )
@@ -0,0 +1,66 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # CallbacksAHandler is responsible for verifying request signatures
8
+ # and parsing incoming callbacksA events into strongly typed objects.
9
+ class CallbacksAHandler
10
+ include CoreLibrary
11
+ # Creates a new instance of the CallbacksAHandler.
12
+ # Initializes the handler.
13
+ # @param [String] secret_key
14
+ # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
+ # @raise [ArgumentError] If the secret_key is not provided.
16
+ def initialize(secret_key)
17
+ raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
+
19
+ @verifier = HmacSignatureVerifier.new(
20
+ secret_key: secret_key,
21
+ signature_header: 'X-Signature',
22
+ hash_algorithm: 'sha256',
23
+ encoder: HexEncoder.new
24
+ )
25
+ end
26
+
27
+ # Perform signature verification and return the result.
28
+ #
29
+ # @param [Rack::Request] request The incoming HTTP request to verify.
30
+ # @return [SignatureVerificationResult] The result of the signature verification.
31
+ def verify(request)
32
+ @verifier.verify(request)
33
+ end
34
+
35
+ # Verify the request signature and parse the event.
36
+ #
37
+ # @param [Rack::Request] request The incoming HTTP request containing the event payload.
38
+ # @return[PaymentCallback, FulfillmentCallback,
39
+ # SignatureVerificationFailure, UnknownEvent]
40
+ # PaymentCallback, FulfillmentCallback for successful parsing;
41
+ #
42
+ # SignatureVerificationFailure when signature fails;
43
+ # UnknownEvent for
44
+ # unknown events.
45
+ def verify_and_parse_event(request)
46
+ unless request.respond_to?(:env) && request.env.is_a?(Hash)
47
+ return SignatureVerificationFailure.new(['Invalid request env.'])
48
+ end
49
+
50
+ raw_body = RackRequestHelper.read_raw_body(request)
51
+ return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
52
+
53
+ verification_result = verify(request)
54
+ return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
55
+
56
+ # Deserialize payload
57
+ begin
58
+ union = UnionTypeLookUp.get(:CallbacksA)
59
+ raw = RackRequestHelper.read_raw_body(request)
60
+ APIHelper.deserialize_union_type(union, raw, false, true)
61
+ rescue StandardError => e
62
+ UnknownEvent.new(['Deserialization failed.', e.message])
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,78 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # CallbacksBHandler is responsible for verifying request signatures
8
+ # and parsing incoming callbacksB events into strongly typed objects.
9
+ class CallbacksBHandler
10
+ include CoreLibrary
11
+ # Creates a new instance of the CallbacksBHandler.
12
+ # Initializes the handler.
13
+ # @param [String] secret_key
14
+ # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
+ # @raise [ArgumentError] If the secret_key is not provided.
16
+ def initialize(secret_key)
17
+ raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
+
19
+ @verifier = HmacSignatureVerifier.new(
20
+ secret_key: secret_key,
21
+ signature_header: 'X-Signature',
22
+ hash_algorithm: 'sha256',
23
+ encoder: HexEncoder.new,
24
+ canonical_message_builder: method(:_canonical_message_builder)
25
+ )
26
+ end
27
+
28
+ # Perform signature verification and return the result.
29
+ #
30
+ # @param [Rack::Request] request The incoming HTTP request to verify.
31
+ # @return [SignatureVerificationResult] The result of the signature verification.
32
+ def verify(request)
33
+ @verifier.verify(request)
34
+ end
35
+
36
+ # Verify the request signature and parse the event.
37
+ #
38
+ # @param [Rack::Request] request The incoming HTTP request containing the event payload.
39
+ # @return[NotificationCallback, SignatureVerificationFailure, UnknownEvent]
40
+ # NotificationCallback for successful parsing;
41
+ #
42
+ # SignatureVerificationFailure when signature fails;
43
+ # UnknownEvent for
44
+ # unknown events.
45
+ def verify_and_parse_event(request)
46
+ unless request.respond_to?(:env) && request.env.is_a?(Hash)
47
+ return SignatureVerificationFailure.new(['Invalid request env.'])
48
+ end
49
+
50
+ raw_body = RackRequestHelper.read_raw_body(request)
51
+ return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
52
+
53
+ verification_result = verify(request)
54
+ return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
55
+
56
+ # Deserialize payload
57
+ begin
58
+ union = UnionTypeLookUp.get(:CallbacksB)
59
+ raw = RackRequestHelper.read_raw_body(request)
60
+ APIHelper.deserialize_union_type(union, raw, false, true)
61
+ rescue StandardError => e
62
+ UnknownEvent.new(['Deserialization failed.', e.message])
63
+ end
64
+ end
65
+
66
+ # Builds the canonical message from the request for the signature verification.
67
+ #
68
+ # @param [Rack::Request] request The incoming HTTP request.
69
+ # @return [String, nil] The canonical message as a string, or nil if it could not be constructed.
70
+ def _canonical_message_builder(request)
71
+ payload = RackRequestHelper.read_raw_body(request)
72
+ notification_type = JsonPointerHelper.get_value_by_json_pointer(
73
+ APIHelper.json_deserialize(payload), 'notificationType'
74
+ )
75
+ notification_type.to_s
76
+ end
77
+ end
78
+ end