wesley-key-sdk 3.0.6 → 4.0.0
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 +4 -4
- data/README.md +156 -132
- data/bin/console +4 -4
- data/lib/webhooks_and_callbacks_api/api_helper.rb +10 -0
- data/lib/{cypress_test_api/controllers/base_controller.rb → webhooks_and_callbacks_api/apis/base_api.rb} +17 -10
- data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
- data/lib/webhooks_and_callbacks_api/client.rb +76 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/configuration.rb +61 -46
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
- data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/exceptions/api_exception.rb +4 -4
- data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
- data/lib/webhooks_and_callbacks_api/http/api_response.rb +19 -0
- data/lib/webhooks_and_callbacks_api/http/auth/api_key.rb +52 -0
- data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
- data/lib/webhooks_and_callbacks_api/http/http_call_back.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_method_enum.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_request.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_response.rb +10 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/http/proxy_settings.rb +4 -4
- data/lib/webhooks_and_callbacks_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/webhooks_and_callbacks_api/logging/sdk_logger.rb +17 -0
- data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
- data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/models/base_model.rb +4 -4
- data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
- data/lib/webhooks_and_callbacks_api/models/delivery_details.rb +104 -0
- data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
- data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
- data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
- data/lib/{cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb → webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb} +19 -19
- data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
- data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
- data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
- data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
- data/lib/webhooks_and_callbacks_api/models/package.rb +95 -0
- data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
- data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
- data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
- data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
- data/lib/webhooks_and_callbacks_api/utilities/date_time_helper.rb +11 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +4 -4
- data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
- data/lib/webhooks_and_callbacks_api.rb +122 -0
- metadata +78 -64
- data/lib/cypress_test_api/api_helper.rb +0 -10
- data/lib/cypress_test_api/client.rb +0 -58
- data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
- data/lib/cypress_test_api/http/http_call_back.rb +0 -10
- data/lib/cypress_test_api/http/http_method_enum.rb +0 -10
- data/lib/cypress_test_api/http/http_request.rb +0 -10
- data/lib/cypress_test_api/http/http_response.rb +0 -10
- data/lib/cypress_test_api/models/custom_enum.rb +0 -40
- data/lib/cypress_test_api/models/deer.rb +0 -68
- data/lib/cypress_test_api/models/item.rb +0 -166
- data/lib/cypress_test_api/models/item_response.rb +0 -80
- data/lib/cypress_test_api/models/lion.rb +0 -68
- data/lib/cypress_test_api/models/message.rb +0 -68
- data/lib/cypress_test_api/models/message2.rb +0 -71
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
- data/lib/cypress_test_api/models/nac_tag.rb +0 -265
- data/lib/cypress_test_api/models/response_http400.rb +0 -62
- data/lib/cypress_test_api/models/response_http404.rb +0 -62
- data/lib/cypress_test_api/models/status11_enum.rb +0 -40
- data/lib/cypress_test_api/models/status1_enum.rb +0 -40
- data/lib/cypress_test_api/models/status_enum.rb +0 -40
- data/lib/cypress_test_api/models/tokens_request.rb +0 -60
- data/lib/cypress_test_api/utilities/date_time_helper.rb +0 -11
- data/lib/cypress_test_api.rb +0 -55
- data/test/controllers/controller_test_base.rb +0 -23
- data/test/controllers/test_api_controller.rb +0 -40
- data/test/http_response_catcher.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32b2ba67ccdc0313bfb0c355ad9fa99a6413618ab32324bd9d6f91d062b02831
|
|
4
|
+
data.tar.gz: '09fb581ec96561ada24b807c5775d75436f750d5c4f56f9a053c8d4fa938aaa6'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8960c201fa1e7c00d4fd8f2f0928fcac566a4fd88ba94f41c22acf70eb8539c2b0e5608852b37ff3353dda04e740d549c59c0bb984b192d80a5eccc7a3e914b3
|
|
7
|
+
data.tar.gz: c048447b48bbecf1651992854ff495daa05526f2ac4a5039c18f607cb2d4e1f19d834f56b782c4a767c96fb647c277df2b42df41b6d645b7b91657a5990f8b3b
|
data/README.md
CHANGED
|
@@ -1,144 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
# Getting Started with
|
|
3
|
-
|
|
4
|
-
## Introduction
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Initialize the API Client
|
|
68
|
-
|
|
69
|
-
**_Note:_** Documentation for the client can be found [here.](
|
|
70
|
-
|
|
71
|
-
The following parameters are configurable for the API Client:
|
|
72
|
-
|
|
73
|
-
| Parameter | Type | Description |
|
|
74
|
-
| --- | --- | --- |
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
|
|
2
|
+
# Getting Started with Webhooks and Callbacks API
|
|
3
|
+
|
|
4
|
+
## Introduction
|
|
5
|
+
|
|
6
|
+
A comprehensive API demonstrating webhooks and callbacks patterns.
|
|
7
|
+
|
|
8
|
+
### Webhooks
|
|
9
|
+
|
|
10
|
+
Webhooks allow your application to receive real-time notifications when certain events occur.
|
|
11
|
+
|
|
12
|
+
### Callbacks
|
|
13
|
+
|
|
14
|
+
Callbacks are used for asynchronous operations where the API will call back to your provided URL when the operation completes.
|
|
15
|
+
|
|
16
|
+
## Install the Package
|
|
17
|
+
|
|
18
|
+
Install the gem from the command line:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
gem install wesley-key-sdk -v 4.0.0
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or add the gem to your Gemfile and run `bundle`:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
gem 'wesley-key-sdk', '4.0.0'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/4.0.0).
|
|
31
|
+
|
|
32
|
+
## IRB Console Usage
|
|
33
|
+
|
|
34
|
+
You can explore the SDK interactively using IRB in two ways
|
|
35
|
+
|
|
36
|
+
### 1. Use IRB with Installed Gem
|
|
37
|
+
|
|
38
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
irb
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Now you can load the SDK in the IRB
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
require 'webhooks_and_callbacks_api'
|
|
48
|
+
include WebhooksAndCallbacksApi
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Use IRB within SDK
|
|
52
|
+
|
|
53
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
cd path/to/webhooks_and_callbacks_api
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Now you can start the preconfigured irb console by running the following command
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ruby bin/console
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**_Note:_** This automatically loads the SDK from lib/
|
|
66
|
+
|
|
67
|
+
## Initialize the API Client
|
|
68
|
+
|
|
69
|
+
**_Note:_** Documentation for the client can be found [here.](doc/client.md)
|
|
70
|
+
|
|
71
|
+
The following parameters are configurable for the API Client:
|
|
72
|
+
|
|
73
|
+
| Parameter | Type | Description |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
76
|
+
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
77
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 50** |
|
|
78
|
+
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
79
|
+
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
|
80
|
+
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
|
81
|
+
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
82
|
+
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put get put]** |
|
|
83
|
+
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
84
|
+
| proxy_settings | [`ProxySettings`](doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
85
|
+
| logging_configuration | [`LoggingConfiguration`](doc/logging-configuration.md) | The SDK logging configuration for API calls |
|
|
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 |
|
|
88
|
+
|
|
89
|
+
The API client can be initialized as follows:
|
|
90
|
+
|
|
91
|
+
### Code-Based Client Initialization
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
require 'webhooks_and_callbacks_api'
|
|
95
|
+
include WebhooksAndCallbacksApi
|
|
95
96
|
|
|
96
97
|
client = Client.new(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
api_key_credentials: ApiKeyCredentials.new(
|
|
99
|
+
x_api_key: 'X-API-Key'
|
|
100
|
+
),
|
|
101
|
+
bearer_auth_credentials: BearerAuthCredentials.new(
|
|
102
|
+
access_token: 'AccessToken'
|
|
103
|
+
),
|
|
104
|
+
logging_configuration: LoggingConfiguration.new(
|
|
105
|
+
log_level: Logger::INFO,
|
|
106
|
+
request_logging_config: RequestLoggingConfiguration.new(
|
|
107
|
+
log_body: true
|
|
108
|
+
),
|
|
109
|
+
response_logging_config: ResponseLoggingConfiguration.new(
|
|
110
|
+
log_headers: true
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Environment-Based Client Initialization
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
require 'webhooks_and_callbacks_api'
|
|
120
|
+
include WebhooksAndCallbacksApi
|
|
107
121
|
|
|
108
122
|
# Create client from environment
|
|
109
|
-
client = Client.from_env
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
See the [`Environment-Based Client Initialization`](
|
|
113
|
-
|
|
114
|
-
##
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
client = Client.from_env
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
See the [`Environment-Based Client Initialization`](doc/environment-based-client-initialization.md) section for details.
|
|
127
|
+
|
|
128
|
+
## Authorization
|
|
129
|
+
|
|
130
|
+
This API uses the following authentication schemes.
|
|
131
|
+
|
|
132
|
+
* [`ApiKey (Custom Header Signature)`](doc/auth/custom-header-signature.md)
|
|
133
|
+
* [`BearerAuth (OAuth 2 Bearer token)`](doc/auth/oauth-2-bearer-token.md)
|
|
134
|
+
|
|
135
|
+
## List of APIs
|
|
136
|
+
|
|
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)
|
|
146
|
+
|
|
147
|
+
## SDK Infrastructure
|
|
148
|
+
|
|
130
149
|
### Configuration
|
|
131
150
|
|
|
132
|
-
* [ProxySettings](
|
|
133
|
-
* [Environment-Based Client Initialization](
|
|
151
|
+
* [ProxySettings](doc/proxy-settings.md)
|
|
152
|
+
* [Environment-Based Client Initialization](doc/environment-based-client-initialization.md)
|
|
153
|
+
* [AbstractLogger](doc/abstract-logger.md)
|
|
154
|
+
* [LoggingConfiguration](doc/logging-configuration.md)
|
|
155
|
+
* [RequestLoggingConfiguration](doc/request-logging-configuration.md)
|
|
156
|
+
* [ResponseLoggingConfiguration](doc/response-logging-configuration.md)
|
|
134
157
|
|
|
135
158
|
### HTTP
|
|
136
159
|
|
|
137
|
-
* [HttpResponse](
|
|
138
|
-
* [HttpRequest](
|
|
160
|
+
* [HttpResponse](doc/http-response.md)
|
|
161
|
+
* [HttpRequest](doc/http-request.md)
|
|
139
162
|
|
|
140
163
|
### Utilities
|
|
141
164
|
|
|
142
|
-
* [
|
|
143
|
-
* [
|
|
144
|
-
|
|
165
|
+
* [ApiResponse](doc/api-response.md)
|
|
166
|
+
* [ApiHelper](doc/api-helper.md)
|
|
167
|
+
* [DateTimeHelper](doc/date-time-helper.md)
|
|
168
|
+
|
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 '
|
|
7
|
+
require 'webhooks_and_callbacks_api'
|
|
8
8
|
|
|
9
|
-
puts '
|
|
10
|
-
puts 'You can now create a client with: client =
|
|
11
|
-
puts 'Or use from_env: client =
|
|
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,23 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# webhooks_and_callbacks_api
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by
|
|
4
|
-
# ( https://www.apimatic.io ).
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
7
|
-
#
|
|
8
|
-
class
|
|
6
|
+
module WebhooksAndCallbacksApi
|
|
7
|
+
# BaseApi.
|
|
8
|
+
class BaseApi
|
|
9
9
|
include CoreLibrary
|
|
10
10
|
attr_accessor :config, :http_call_back
|
|
11
11
|
|
|
12
|
-
def self.user_agent
|
|
13
|
-
'
|
|
12
|
+
def self.user_agent
|
|
13
|
+
'Ruby-SDK/4.0.0 (OS: {os-info}, Engine: {engine}/{engine-version})'
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def self.user_agent_parameters
|
|
17
|
+
{
|
|
18
|
+
'{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
|
|
19
|
+
'{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
|
|
20
|
+
'{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
|
|
21
|
+
}
|
|
22
|
+
end
|
|
16
23
|
|
|
17
|
-
GLOBAL_ERRORS = {
|
|
24
|
+
GLOBAL_ERRORS = {
|
|
18
25
|
'default' => ErrorCase.new
|
|
19
26
|
.error_message('HTTP response not OK.')
|
|
20
|
-
.exception_type(APIException)
|
|
27
|
+
.exception_type(APIException)
|
|
21
28
|
}.freeze
|
|
22
29
|
|
|
23
30
|
# Initialization constructor.
|
|
@@ -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
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
# webhooks_and_callbacks_api client class.
|
|
8
|
+
class Client
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_reader :config, :auth_managers
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Access to orders controller.
|
|
17
|
+
# @return [OrdersApi] Returns the controller instance.
|
|
18
|
+
def orders
|
|
19
|
+
@orders ||= OrdersApi.new @global_configuration
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize(
|
|
23
|
+
connection: nil, adapter: :net_http_persistent, timeout: 50,
|
|
24
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
25
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
26
|
+
retry_methods: %i[get put get put], http_callback: nil,
|
|
27
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
28
|
+
environment: Environment::PRODUCTION, api_key_credentials: nil,
|
|
29
|
+
bearer_auth_credentials: nil, config: nil
|
|
30
|
+
)
|
|
31
|
+
@config = if config.nil?
|
|
32
|
+
Configuration.new(
|
|
33
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
|
34
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
35
|
+
backoff_factor: backoff_factor,
|
|
36
|
+
retry_statuses: retry_statuses,
|
|
37
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
38
|
+
proxy_settings: proxy_settings,
|
|
39
|
+
logging_configuration: logging_configuration,
|
|
40
|
+
environment: environment,
|
|
41
|
+
api_key_credentials: api_key_credentials,
|
|
42
|
+
bearer_auth_credentials: bearer_auth_credentials
|
|
43
|
+
)
|
|
44
|
+
else
|
|
45
|
+
config
|
|
46
|
+
end
|
|
47
|
+
user_agent_params = BaseApi.user_agent_parameters
|
|
48
|
+
|
|
49
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
50
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
|
51
|
+
.global_errors(BaseApi::GLOBAL_ERRORS)
|
|
52
|
+
.user_agent(BaseApi.user_agent,
|
|
53
|
+
agent_parameters: user_agent_params)
|
|
54
|
+
|
|
55
|
+
initialize_auth_managers(@global_configuration)
|
|
56
|
+
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Initializes the auth managers hash used for authenticating API calls.
|
|
60
|
+
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
|
61
|
+
def initialize_auth_managers(global_config)
|
|
62
|
+
@auth_managers = {}
|
|
63
|
+
http_client_config = global_config.client_configuration
|
|
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)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Creates a client directly from environment variables.
|
|
70
|
+
def self.from_env(**overrides)
|
|
71
|
+
default_config = Configuration.build_default_config_from_env
|
|
72
|
+
new_config = default_config.clone_with(**overrides)
|
|
73
|
+
new(config: new_config)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|