wesley-key-sdk 4.0.0 → 4.2.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 +47 -34
- data/bin/console +4 -4
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/api_helper.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/apis/base_api.rb +3 -3
- data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
- data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
- data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/client.rb +34 -15
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/configuration.rb +30 -20
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +2 -2
- data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/api_response.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/auth/api_key.rb +15 -15
- data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_call_back.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_method_enum.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_request.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_response.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/proxy_settings.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/configuration/api_logging_configuration.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/sdk_logger.rb +2 -2
- data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/models/base_model.rb +2 -2
- data/lib/{webhooks_and_callbacks_api/models/package.rb → swagger_petstore_open_api30/models/category.rb} +39 -29
- data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
- data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
- data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
- data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
- data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
- data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
- data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
- data/lib/{webhooks_and_callbacks_api/models/delivery_details.rb → swagger_petstore_open_api30/models/tag.rb} +36 -35
- data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/date_time_helper.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +2 -2
- data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
- data/lib/swagger_petstore_open_api30.rb +62 -0
- metadata +37 -78
- data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +0 -34
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +0 -66
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +0 -78
- data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +0 -33
- data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +0 -14
- data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +0 -32
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +0 -67
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +0 -86
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +0 -79
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +0 -67
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +0 -39
- data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +0 -57
- data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +0 -53
- data/lib/webhooks_and_callbacks_api/models/address.rb +0 -114
- data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +0 -115
- data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +0 -131
- data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +0 -97
- data/lib/webhooks_and_callbacks_api/models/event.rb +0 -52
- data/lib/webhooks_and_callbacks_api/models/event_type.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type1.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type2.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type3.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +0 -411
- data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +0 -119
- data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +0 -44
- data/lib/webhooks_and_callbacks_api/models/order.rb +0 -161
- data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +0 -314
- data/lib/webhooks_and_callbacks_api/models/order_item.rb +0 -102
- data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +0 -100
- data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +0 -167
- data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +0 -98
- data/lib/webhooks_and_callbacks_api/models/payment_status.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +0 -89
- data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +0 -89
- data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +0 -98
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +0 -95
- data/lib/webhooks_and_callbacks_api/models/status.rb +0 -44
- data/lib/webhooks_and_callbacks_api/models/status1.rb +0 -36
- data/lib/webhooks_and_callbacks_api/models/status2.rb +0 -36
- data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/webhook.rb +0 -142
- data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +0 -103
- data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +0 -105
- data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +0 -172
- data/lib/webhooks_and_callbacks_api.rb +0 -122
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f22b22395a8452f239db0c529bcd4bd9c4d209bc42dece0aa51ccda0794bf274
|
|
4
|
+
data.tar.gz: 646a929e08b140f97c9ff50c7aa9e052d087e5880f5b13b0f045d84dfa6a4bb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b841fcc3575323415331051808a172ab7b2f10380c9292190d122a6912b6e68ab655654905faa41949e252c2b1aa9ba9923146dab8c32bb85eb24b8cee1d241
|
|
7
|
+
data.tar.gz: e7865b424ea16c05604c1ed249dcc4665279c35b890ea60736597b6c0476889121b9a662e67f40956192fc8e372c496fe1920e43ddf75cf1e0101462a53783bd
|
data/README.md
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
|
|
2
|
-
# Getting Started with
|
|
2
|
+
# Getting Started with Swagger Petstore - OpenAPI 3.0
|
|
3
3
|
|
|
4
4
|
## Introduction
|
|
5
5
|
|
|
6
|
-
|
|
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.
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
Some useful links:
|
|
9
12
|
|
|
10
|
-
|
|
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)
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Callbacks are used for asynchronous operations where the API will call back to your provided URL when the operation completes.
|
|
16
|
+
Find out more about Swagger: [https://swagger.io](https://swagger.io)
|
|
15
17
|
|
|
16
18
|
## Install the Package
|
|
17
19
|
|
|
18
20
|
Install the gem from the command line:
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
|
-
gem install wesley-key-sdk -v 4.
|
|
23
|
+
gem install wesley-key-sdk -v 4.2.0
|
|
22
24
|
```
|
|
23
25
|
|
|
24
26
|
Or add the gem to your Gemfile and run `bundle`:
|
|
25
27
|
|
|
26
28
|
```ruby
|
|
27
|
-
gem 'wesley-key-sdk', '4.
|
|
29
|
+
gem 'wesley-key-sdk', '4.2.0'
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/4.
|
|
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).
|
|
31
33
|
|
|
32
34
|
## IRB Console Usage
|
|
33
35
|
|
|
@@ -44,8 +46,8 @@ irb
|
|
|
44
46
|
Now you can load the SDK in the IRB
|
|
45
47
|
|
|
46
48
|
```ruby
|
|
47
|
-
require '
|
|
48
|
-
include
|
|
49
|
+
require 'swagger_petstore_open_api30'
|
|
50
|
+
include SwaggerPetstoreOpenApi30
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
### 2. Use IRB within SDK
|
|
@@ -53,7 +55,7 @@ include WebhooksAndCallbacksApi
|
|
|
53
55
|
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
54
56
|
|
|
55
57
|
```
|
|
56
|
-
cd path/to/
|
|
58
|
+
cd path/to/swagger_petstore_open_api30
|
|
57
59
|
```
|
|
58
60
|
|
|
59
61
|
Now you can start the preconfigured irb console by running the following command
|
|
@@ -72,9 +74,10 @@ The following parameters are configurable for the API Client:
|
|
|
72
74
|
|
|
73
75
|
| Parameter | Type | Description |
|
|
74
76
|
| --- | --- | --- |
|
|
77
|
+
| environment | [`Environment`](README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
|
75
78
|
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
76
79
|
| 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:
|
|
80
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
|
|
78
81
|
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
79
82
|
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
|
80
83
|
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
|
@@ -83,24 +86,30 @@ The following parameters are configurable for the API Client:
|
|
|
83
86
|
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
84
87
|
| proxy_settings | [`ProxySettings`](doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
85
88
|
| 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 |
|
|
86
90
|
| 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
91
|
|
|
89
92
|
The API client can be initialized as follows:
|
|
90
93
|
|
|
91
94
|
### Code-Based Client Initialization
|
|
92
95
|
|
|
93
96
|
```ruby
|
|
94
|
-
require '
|
|
95
|
-
include
|
|
97
|
+
require 'swagger_petstore_open_api30'
|
|
98
|
+
include SwaggerPetstoreOpenApi30
|
|
96
99
|
|
|
97
100
|
client = Client.new(
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
]
|
|
100
108
|
),
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
api_key_credentials: ApiKeyCredentials.new(
|
|
110
|
+
api_key: 'api_key'
|
|
103
111
|
),
|
|
112
|
+
environment: Environment::PRODUCTION,
|
|
104
113
|
logging_configuration: LoggingConfiguration.new(
|
|
105
114
|
log_level: Logger::INFO,
|
|
106
115
|
request_logging_config: RequestLoggingConfiguration.new(
|
|
@@ -116,8 +125,8 @@ client = Client.new(
|
|
|
116
125
|
### Environment-Based Client Initialization
|
|
117
126
|
|
|
118
127
|
```ruby
|
|
119
|
-
require '
|
|
120
|
-
include
|
|
128
|
+
require 'swagger_petstore_open_api30'
|
|
129
|
+
include SwaggerPetstoreOpenApi30
|
|
121
130
|
|
|
122
131
|
# Create client from environment
|
|
123
132
|
client = Client.from_env
|
|
@@ -125,24 +134,28 @@ client = Client.from_env
|
|
|
125
134
|
|
|
126
135
|
See the [`Environment-Based Client Initialization`](doc/environment-based-client-initialization.md) section for details.
|
|
127
136
|
|
|
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
|
+
|
|
128
147
|
## Authorization
|
|
129
148
|
|
|
130
149
|
This API uses the following authentication schemes.
|
|
131
150
|
|
|
132
|
-
* [`
|
|
133
|
-
* [`
|
|
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)
|
|
134
153
|
|
|
135
154
|
## List of APIs
|
|
136
155
|
|
|
137
|
-
* [
|
|
138
|
-
|
|
139
|
-
|
|
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)
|
|
156
|
+
* [Pet](doc/controllers/pet.md)
|
|
157
|
+
* [Store](doc/controllers/store.md)
|
|
158
|
+
* [User](doc/controllers/user.md)
|
|
146
159
|
|
|
147
160
|
## SDK Infrastructure
|
|
148
161
|
|
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 'swagger_petstore_open_api30'
|
|
8
8
|
|
|
9
|
-
puts '
|
|
10
|
-
puts 'You can now create a client with: client =
|
|
11
|
-
puts 'Or use from_env: client =
|
|
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'
|
|
12
12
|
|
|
13
13
|
# Start an interactive IRB session
|
|
14
14
|
require 'irb'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# API utility class
|
|
8
8
|
class APIHelper < CoreLibrary::ApiHelper
|
|
9
9
|
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
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.
|
|
13
|
+
'Ruby-SDK/4.2.0 (OS: {os-info}, Engine: {engine}/{engine-version})'
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def self.user_agent_parameters
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# PetApi
|
|
8
|
+
class PetApi < BaseApi
|
|
9
|
+
# Update an existing pet by Id.
|
|
10
|
+
# @param [String] name Required parameter: TODO: type description here
|
|
11
|
+
# @param [Array[String]] photo_urls Required parameter: TODO: type
|
|
12
|
+
# description here
|
|
13
|
+
# @param [Integer] id Optional parameter: TODO: type description here
|
|
14
|
+
# @param [Category] category Optional parameter: TODO: type description
|
|
15
|
+
# here
|
|
16
|
+
# @param [Array[Tag]] tags Optional parameter: TODO: type description here
|
|
17
|
+
# @param [PetStatus] status Optional parameter: pet status in the store
|
|
18
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
19
|
+
def update_pet(name,
|
|
20
|
+
photo_urls,
|
|
21
|
+
id: nil,
|
|
22
|
+
category: nil,
|
|
23
|
+
tags: nil,
|
|
24
|
+
status: nil)
|
|
25
|
+
@api_call
|
|
26
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
27
|
+
'/pet',
|
|
28
|
+
Server::DEFAULT)
|
|
29
|
+
.form_param(new_parameter(name, key: 'name')
|
|
30
|
+
.is_required(true))
|
|
31
|
+
.form_param(new_parameter(photo_urls, key: 'photoUrls')
|
|
32
|
+
.is_required(true))
|
|
33
|
+
.form_param(new_parameter(id, key: 'id'))
|
|
34
|
+
.form_param(new_parameter(category, key: 'category'))
|
|
35
|
+
.form_param(new_parameter(tags, key: 'tags'))
|
|
36
|
+
.form_param(new_parameter(status, key: 'status'))
|
|
37
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
38
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
39
|
+
.auth(Single.new('petstore_auth')))
|
|
40
|
+
.response(new_response_handler
|
|
41
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
42
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
43
|
+
.is_api_response(true)
|
|
44
|
+
.local_error('400',
|
|
45
|
+
'Invalid ID supplied',
|
|
46
|
+
APIException)
|
|
47
|
+
.local_error('404',
|
|
48
|
+
'Pet not found',
|
|
49
|
+
APIException)
|
|
50
|
+
.local_error('422',
|
|
51
|
+
'Validation exception',
|
|
52
|
+
APIException)
|
|
53
|
+
.local_error('default',
|
|
54
|
+
'Unexpected error',
|
|
55
|
+
APIException))
|
|
56
|
+
.execute
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Add a new pet to the store.
|
|
60
|
+
# @param [String] name Required parameter: TODO: type description here
|
|
61
|
+
# @param [Array[String]] photo_urls Required parameter: TODO: type
|
|
62
|
+
# description here
|
|
63
|
+
# @param [Integer] id Optional parameter: TODO: type description here
|
|
64
|
+
# @param [Category] category Optional parameter: TODO: type description
|
|
65
|
+
# here
|
|
66
|
+
# @param [Array[Tag]] tags Optional parameter: TODO: type description here
|
|
67
|
+
# @param [PetStatus] status Optional parameter: pet status in the store
|
|
68
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
69
|
+
def add_pet(name,
|
|
70
|
+
photo_urls,
|
|
71
|
+
id: nil,
|
|
72
|
+
category: nil,
|
|
73
|
+
tags: nil,
|
|
74
|
+
status: nil)
|
|
75
|
+
@api_call
|
|
76
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
77
|
+
'/pet',
|
|
78
|
+
Server::DEFAULT)
|
|
79
|
+
.form_param(new_parameter(name, key: 'name')
|
|
80
|
+
.is_required(true))
|
|
81
|
+
.form_param(new_parameter(photo_urls, key: 'photoUrls')
|
|
82
|
+
.is_required(true))
|
|
83
|
+
.form_param(new_parameter(id, key: 'id'))
|
|
84
|
+
.form_param(new_parameter(category, key: 'category'))
|
|
85
|
+
.form_param(new_parameter(tags, key: 'tags'))
|
|
86
|
+
.form_param(new_parameter(status, key: 'status'))
|
|
87
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
88
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
89
|
+
.auth(Single.new('petstore_auth')))
|
|
90
|
+
.response(new_response_handler
|
|
91
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
92
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
93
|
+
.is_api_response(true)
|
|
94
|
+
.local_error('400',
|
|
95
|
+
'Invalid input',
|
|
96
|
+
APIException)
|
|
97
|
+
.local_error('422',
|
|
98
|
+
'Validation exception',
|
|
99
|
+
APIException)
|
|
100
|
+
.local_error('default',
|
|
101
|
+
'Unexpected error',
|
|
102
|
+
APIException))
|
|
103
|
+
.execute
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Multiple status values can be provided with comma separated strings.
|
|
107
|
+
# @param [PetStatus] status Optional parameter: Status values that need to
|
|
108
|
+
# be considered for filter
|
|
109
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
110
|
+
def find_pets_by_status(status: nil)
|
|
111
|
+
@api_call
|
|
112
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
113
|
+
'/pet/findByStatus',
|
|
114
|
+
Server::DEFAULT)
|
|
115
|
+
.query_param(new_parameter(status, key: 'status'))
|
|
116
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
117
|
+
.auth(Single.new('petstore_auth')))
|
|
118
|
+
.response(new_response_handler
|
|
119
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
120
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
121
|
+
.is_api_response(true)
|
|
122
|
+
.is_response_array(true)
|
|
123
|
+
.local_error('400',
|
|
124
|
+
'Invalid status value',
|
|
125
|
+
APIException)
|
|
126
|
+
.local_error('default',
|
|
127
|
+
'Unexpected error',
|
|
128
|
+
APIException))
|
|
129
|
+
.execute
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Multiple tags can be provided with comma separated strings. Use tag1,
|
|
133
|
+
# tag2, tag3 for testing.
|
|
134
|
+
# @param [Array[String]] tags Optional parameter: Tags to filter by
|
|
135
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
136
|
+
def find_pets_by_tags(tags: nil)
|
|
137
|
+
@api_call
|
|
138
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
139
|
+
'/pet/findByTags',
|
|
140
|
+
Server::DEFAULT)
|
|
141
|
+
.query_param(new_parameter(tags, key: 'tags'))
|
|
142
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
143
|
+
.auth(Single.new('petstore_auth')))
|
|
144
|
+
.response(new_response_handler
|
|
145
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
146
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
147
|
+
.is_api_response(true)
|
|
148
|
+
.is_response_array(true)
|
|
149
|
+
.local_error('400',
|
|
150
|
+
'Invalid tag value',
|
|
151
|
+
APIException)
|
|
152
|
+
.local_error('default',
|
|
153
|
+
'Unexpected error',
|
|
154
|
+
APIException))
|
|
155
|
+
.execute
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Returns a single pet.
|
|
159
|
+
# @param [Integer] pet_id Required parameter: ID of pet to return
|
|
160
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
161
|
+
def get_pet_by_id(pet_id)
|
|
162
|
+
@api_call
|
|
163
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
164
|
+
'/pet/{petId}',
|
|
165
|
+
Server::DEFAULT)
|
|
166
|
+
.template_param(new_parameter(pet_id, key: 'petId')
|
|
167
|
+
.is_required(true)
|
|
168
|
+
.should_encode(true))
|
|
169
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
170
|
+
.auth(Or.new('api_key', 'petstore_auth')))
|
|
171
|
+
.response(new_response_handler
|
|
172
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
173
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
174
|
+
.is_api_response(true)
|
|
175
|
+
.local_error('400',
|
|
176
|
+
'Invalid ID supplied',
|
|
177
|
+
APIException)
|
|
178
|
+
.local_error('404',
|
|
179
|
+
'Pet not found',
|
|
180
|
+
APIException)
|
|
181
|
+
.local_error('default',
|
|
182
|
+
'Unexpected error',
|
|
183
|
+
APIException))
|
|
184
|
+
.execute
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Updates a pet resource based on the form data.
|
|
188
|
+
# @param [Integer] pet_id Required parameter: ID of pet that needs to be
|
|
189
|
+
# updated
|
|
190
|
+
# @param [String] name Optional parameter: Name of pet that needs to be
|
|
191
|
+
# updated
|
|
192
|
+
# @param [String] status Optional parameter: Status of pet that needs to be
|
|
193
|
+
# updated
|
|
194
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
195
|
+
def update_pet_with_form(pet_id,
|
|
196
|
+
name: nil,
|
|
197
|
+
status: nil)
|
|
198
|
+
@api_call
|
|
199
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
200
|
+
'/pet/{petId}',
|
|
201
|
+
Server::DEFAULT)
|
|
202
|
+
.template_param(new_parameter(pet_id, key: 'petId')
|
|
203
|
+
.is_required(true)
|
|
204
|
+
.should_encode(true))
|
|
205
|
+
.query_param(new_parameter(name, key: 'name'))
|
|
206
|
+
.query_param(new_parameter(status, key: 'status'))
|
|
207
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
208
|
+
.auth(Single.new('petstore_auth')))
|
|
209
|
+
.response(new_response_handler
|
|
210
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
211
|
+
.deserialize_into(Pet.method(:from_hash))
|
|
212
|
+
.is_api_response(true)
|
|
213
|
+
.local_error('400',
|
|
214
|
+
'Invalid input',
|
|
215
|
+
APIException)
|
|
216
|
+
.local_error('default',
|
|
217
|
+
'Unexpected error',
|
|
218
|
+
APIException))
|
|
219
|
+
.execute
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Delete a pet.
|
|
223
|
+
# @param [Integer] pet_id Required parameter: Pet id to delete
|
|
224
|
+
# @param [String] api_key Optional parameter: TODO: type description here
|
|
225
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
226
|
+
def delete_pet(pet_id,
|
|
227
|
+
api_key: nil)
|
|
228
|
+
@api_call
|
|
229
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
230
|
+
'/pet/{petId}',
|
|
231
|
+
Server::DEFAULT)
|
|
232
|
+
.template_param(new_parameter(pet_id, key: 'petId')
|
|
233
|
+
.is_required(true)
|
|
234
|
+
.should_encode(true))
|
|
235
|
+
.header_param(new_parameter(api_key, key: 'api_key'))
|
|
236
|
+
.auth(Single.new('petstore_auth')))
|
|
237
|
+
.response(new_response_handler
|
|
238
|
+
.is_response_void(true)
|
|
239
|
+
.is_api_response(true)
|
|
240
|
+
.local_error('400',
|
|
241
|
+
'Invalid pet value',
|
|
242
|
+
APIException)
|
|
243
|
+
.local_error('default',
|
|
244
|
+
'Unexpected error',
|
|
245
|
+
APIException))
|
|
246
|
+
.execute
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Upload image of the pet.
|
|
250
|
+
# @param [Integer] pet_id Required parameter: ID of pet to update
|
|
251
|
+
# @param [String] additional_metadata Optional parameter: Additional
|
|
252
|
+
# Metadata
|
|
253
|
+
# @param [File | UploadIO] body Optional parameter: TODO: type description
|
|
254
|
+
# here
|
|
255
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
256
|
+
def upload_file(pet_id,
|
|
257
|
+
additional_metadata: nil,
|
|
258
|
+
body: nil)
|
|
259
|
+
@api_call
|
|
260
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
261
|
+
'/pet/{petId}/uploadImage',
|
|
262
|
+
Server::DEFAULT)
|
|
263
|
+
.template_param(new_parameter(pet_id, key: 'petId')
|
|
264
|
+
.is_required(true)
|
|
265
|
+
.should_encode(true))
|
|
266
|
+
.query_param(new_parameter(additional_metadata, key: 'additionalMetadata'))
|
|
267
|
+
.multipart_param(new_parameter(body, key: 'body')
|
|
268
|
+
.default_content_type('application/octet-stream'))
|
|
269
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
270
|
+
.auth(Single.new('petstore_auth')))
|
|
271
|
+
.response(new_response_handler
|
|
272
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
273
|
+
.deserialize_into(ApiResponse.method(:from_hash))
|
|
274
|
+
.is_api_response(true)
|
|
275
|
+
.local_error('400',
|
|
276
|
+
'No file uploaded',
|
|
277
|
+
APIException)
|
|
278
|
+
.local_error('404',
|
|
279
|
+
'Pet not found',
|
|
280
|
+
APIException)
|
|
281
|
+
.local_error('default',
|
|
282
|
+
'Unexpected error',
|
|
283
|
+
APIException))
|
|
284
|
+
.execute
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# StoreApi
|
|
8
|
+
class StoreApi < BaseApi
|
|
9
|
+
# Returns a map of status codes to quantities.
|
|
10
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
11
|
+
def get_inventory
|
|
12
|
+
@api_call
|
|
13
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
14
|
+
'/store/inventory',
|
|
15
|
+
Server::DEFAULT)
|
|
16
|
+
.auth(Single.new('api_key')))
|
|
17
|
+
.response(new_response_handler
|
|
18
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
19
|
+
.deserialize_into(proc do |response| response&.to_i end)
|
|
20
|
+
.is_api_response(true)
|
|
21
|
+
.is_primitive_response(true)
|
|
22
|
+
.local_error('default',
|
|
23
|
+
'Unexpected error',
|
|
24
|
+
APIException))
|
|
25
|
+
.execute
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Place a new order in the store.
|
|
29
|
+
# @param [Integer] id Optional parameter: TODO: type description here
|
|
30
|
+
# @param [Integer] pet_id Optional parameter: TODO: type description here
|
|
31
|
+
# @param [Integer] quantity Optional parameter: TODO: type description
|
|
32
|
+
# here
|
|
33
|
+
# @param [DateTime] ship_date Optional parameter: TODO: type description
|
|
34
|
+
# here
|
|
35
|
+
# @param [OrderStatus] status Optional parameter: Order Status
|
|
36
|
+
# @param [TrueClass | FalseClass] complete Optional parameter: TODO: type
|
|
37
|
+
# description here
|
|
38
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
39
|
+
def place_order(id: nil,
|
|
40
|
+
pet_id: nil,
|
|
41
|
+
quantity: nil,
|
|
42
|
+
ship_date: nil,
|
|
43
|
+
status: nil,
|
|
44
|
+
complete: nil)
|
|
45
|
+
@api_call
|
|
46
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
47
|
+
'/store/order',
|
|
48
|
+
Server::DEFAULT)
|
|
49
|
+
.form_param(new_parameter(id, key: 'id'))
|
|
50
|
+
.form_param(new_parameter(pet_id, key: 'petId'))
|
|
51
|
+
.form_param(new_parameter(quantity, key: 'quantity'))
|
|
52
|
+
.form_param(new_parameter(ship_date, key: 'shipDate'))
|
|
53
|
+
.form_param(new_parameter(status, key: 'status'))
|
|
54
|
+
.form_param(new_parameter(complete, key: 'complete'))
|
|
55
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
56
|
+
.header_param(new_parameter('application/json', key: 'accept')))
|
|
57
|
+
.response(new_response_handler
|
|
58
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
59
|
+
.deserialize_into(Order.method(:from_hash))
|
|
60
|
+
.is_api_response(true)
|
|
61
|
+
.local_error('400',
|
|
62
|
+
'Invalid input',
|
|
63
|
+
APIException)
|
|
64
|
+
.local_error('422',
|
|
65
|
+
'Validation exception',
|
|
66
|
+
APIException)
|
|
67
|
+
.local_error('default',
|
|
68
|
+
'Unexpected error',
|
|
69
|
+
APIException))
|
|
70
|
+
.execute
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# For valid response try integer IDs with value <= 5 or > 10. Other values
|
|
74
|
+
# will generate exceptions.
|
|
75
|
+
# @param [Integer] order_id Required parameter: ID of order that needs to be
|
|
76
|
+
# fetched
|
|
77
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
78
|
+
def get_order_by_id(order_id)
|
|
79
|
+
@api_call
|
|
80
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
81
|
+
'/store/order/{orderId}',
|
|
82
|
+
Server::DEFAULT)
|
|
83
|
+
.template_param(new_parameter(order_id, key: 'orderId')
|
|
84
|
+
.is_required(true)
|
|
85
|
+
.should_encode(true))
|
|
86
|
+
.header_param(new_parameter('application/json', key: 'accept')))
|
|
87
|
+
.response(new_response_handler
|
|
88
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
89
|
+
.deserialize_into(Order.method(:from_hash))
|
|
90
|
+
.is_api_response(true)
|
|
91
|
+
.local_error('400',
|
|
92
|
+
'Invalid ID supplied',
|
|
93
|
+
APIException)
|
|
94
|
+
.local_error('404',
|
|
95
|
+
'Order not found',
|
|
96
|
+
APIException)
|
|
97
|
+
.local_error('default',
|
|
98
|
+
'Unexpected error',
|
|
99
|
+
APIException))
|
|
100
|
+
.execute
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# For valid response try integer IDs with value < 1000. Anything above 1000
|
|
104
|
+
# or non-integers will generate API errors.
|
|
105
|
+
# @param [Integer] order_id Required parameter: ID of the order that needs
|
|
106
|
+
# to be deleted
|
|
107
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
108
|
+
def delete_order(order_id)
|
|
109
|
+
@api_call
|
|
110
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
111
|
+
'/store/order/{orderId}',
|
|
112
|
+
Server::DEFAULT)
|
|
113
|
+
.template_param(new_parameter(order_id, key: 'orderId')
|
|
114
|
+
.is_required(true)
|
|
115
|
+
.should_encode(true)))
|
|
116
|
+
.response(new_response_handler
|
|
117
|
+
.is_response_void(true)
|
|
118
|
+
.is_api_response(true)
|
|
119
|
+
.local_error('400',
|
|
120
|
+
'Invalid ID supplied',
|
|
121
|
+
APIException)
|
|
122
|
+
.local_error('404',
|
|
123
|
+
'Order not found',
|
|
124
|
+
APIException)
|
|
125
|
+
.local_error('default',
|
|
126
|
+
'Unexpected error',
|
|
127
|
+
APIException))
|
|
128
|
+
.execute
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|