demo-vender 1.5.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.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +173 -0
  4. data/bin/console +15 -0
  5. data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
  6. data/lib/swagger_petstore_open_api30/apis/base_api.rb +67 -0
  7. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
  8. data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
  9. data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
  10. data/lib/swagger_petstore_open_api30/client.rb +95 -0
  11. data/lib/swagger_petstore_open_api30/configuration.rb +181 -0
  12. data/lib/swagger_petstore_open_api30/exceptions/api_exception.rb +21 -0
  13. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
  14. data/lib/swagger_petstore_open_api30/http/api_response.rb +19 -0
  15. data/lib/swagger_petstore_open_api30/http/auth/api_key.rb +52 -0
  16. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
  17. data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
  18. data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
  19. data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
  20. data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
  21. data/lib/swagger_petstore_open_api30/http/proxy_settings.rb +22 -0
  22. data/lib/swagger_petstore_open_api30/logging/configuration/api_logging_configuration.rb +186 -0
  23. data/lib/swagger_petstore_open_api30/logging/sdk_logger.rb +17 -0
  24. data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
  25. data/lib/swagger_petstore_open_api30/models/base_model.rb +110 -0
  26. data/lib/swagger_petstore_open_api30/models/category.rb +105 -0
  27. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
  28. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
  29. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
  30. data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
  31. data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
  32. data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
  33. data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
  34. data/lib/swagger_petstore_open_api30/models/tag.rb +105 -0
  35. data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
  36. data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
  37. data/lib/swagger_petstore_open_api30/utilities/file_wrapper.rb +28 -0
  38. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
  39. data/lib/swagger_petstore_open_api30.rb +62 -0
  40. metadata +122 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb4e260a06a44ab1f1ee5454dfa6ae55bf640008baf82664f22fe9acc9492081
4
+ data.tar.gz: f6b0068e256901466a1899be3505598905afa38c8ff1f9444e6c3d5a486fa7ea
5
+ SHA512:
6
+ metadata.gz: 34988fc5c582f9b1871e9f60e084e367f658d27f38f9b0a4ac36d0cc8134af0f286043d636e8a4de045bba485a754676f3dda2ba26662d52743662c1730bdee4
7
+ data.tar.gz: 985fbaa01bd3aac5073301c38a069578b70a2209b8acd4685b74b08793e38ccc29e3c8e83e2d5d3e57650e74e4b221210b18db68edca137954bcf305fa5064a0
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+
2
+ # Getting Started with Swagger Petstore - OpenAPI 3.0
3
+
4
+ ## Introduction
5
+
6
+ Sample Pet Store Server based on the OpenAPI 3.0 specification.
7
+
8
+ Find out more about Swagger: [https://swagger.io](https://swagger.io)
9
+
10
+ ## Install the Package
11
+
12
+ Install the gem from the command line:
13
+
14
+ ```bash
15
+ gem install demo-vender -v 1.5.0
16
+ ```
17
+
18
+ Or add the gem to your Gemfile and run `bundle`:
19
+
20
+ ```ruby
21
+ gem 'demo-vender', '1.5.0'
22
+ ```
23
+
24
+ For additional gem details, see the [RubyGems page for the demo-vender gem](https://rubygems.org/gems/demo-vender/versions/1.5.0).
25
+
26
+ ## IRB Console Usage
27
+
28
+ You can explore the SDK interactively using IRB in two ways
29
+
30
+ ### 1. Use IRB with Installed Gem
31
+
32
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
33
+
34
+ ```bash
35
+ irb
36
+ ```
37
+
38
+ Now you can load the SDK in the IRB
39
+
40
+ ```ruby
41
+ require 'swagger_petstore_open_api30'
42
+ include SwaggerPetstoreOpenApi30
43
+ ```
44
+
45
+ ### 2. Use IRB within SDK
46
+
47
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
48
+
49
+ ```
50
+ cd path/to/swagger_petstore_open_api30
51
+ ```
52
+
53
+ Now you can start the preconfigured irb console by running the following command
54
+
55
+ ```bash
56
+ ruby bin/console
57
+ ```
58
+
59
+ **_Note:_** This automatically loads the SDK from lib/
60
+
61
+ ## Initialize the API Client
62
+
63
+ **_Note:_** Documentation for the client can be found [here.](doc/client.md)
64
+
65
+ The following parameters are configurable for the API Client:
66
+
67
+ | Parameter | Type | Description |
68
+ | --- | --- | --- |
69
+ | environment | [`Environment`](README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
70
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
71
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
72
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
73
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
74
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
75
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
76
+ | 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]** |
77
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put get put]** |
78
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
79
+ | proxy_settings | [`ProxySettings`](doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
80
+ | logging_configuration | [`LoggingConfiguration`](doc/logging-configuration.md) | The SDK logging configuration for API calls |
81
+ | petstore_auth_credentials | [`PetstoreAuthCredentials`](doc/auth/oauth-2-implicit-grant.md) | The credential object for OAuth 2 Implicit Grant |
82
+ | api_key_credentials | [`ApiKeyCredentials`](doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
83
+
84
+ The API client can be initialized as follows:
85
+
86
+ ### Code-Based Client Initialization
87
+
88
+ ```ruby
89
+ require 'swagger_petstore_open_api30'
90
+ include SwaggerPetstoreOpenApi30
91
+
92
+ client = Client.new(
93
+ petstore_auth_credentials: PetstoreAuthCredentials.new(
94
+ oauth_client_id: 'OAuthClientId',
95
+ oauth_redirect_uri: 'OAuthRedirectUri',
96
+ oauth_scopes: [
97
+ OauthScopePetstoreAuth::WRITEPETS,
98
+ OauthScopePetstoreAuth::READPETS
99
+ ]
100
+ ),
101
+ api_key_credentials: ApiKeyCredentials.new(
102
+ api_key: 'api_key'
103
+ ),
104
+ environment: Environment::PRODUCTION,
105
+ logging_configuration: LoggingConfiguration.new(
106
+ log_level: Logger::INFO,
107
+ request_logging_config: RequestLoggingConfiguration.new(
108
+ log_body: true
109
+ ),
110
+ response_logging_config: ResponseLoggingConfiguration.new(
111
+ log_headers: true
112
+ )
113
+ )
114
+ )
115
+ ```
116
+
117
+ ### Environment-Based Client Initialization
118
+
119
+ ```ruby
120
+ require 'swagger_petstore_open_api30'
121
+ include SwaggerPetstoreOpenApi30
122
+
123
+ # Create client from environment
124
+ client = Client.from_env
125
+ ```
126
+
127
+ See the [`Environment-Based Client Initialization`](doc/environment-based-client-initialization.md) section for details.
128
+
129
+ ## Environments
130
+
131
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
132
+
133
+ ### Fields
134
+
135
+ | Name | Description |
136
+ | --- | --- |
137
+ | PRODUCTION | **Default** |
138
+
139
+ ## Authorization
140
+
141
+ This API uses the following authentication schemes.
142
+
143
+ * [`petstore_auth (OAuth 2 Implicit Grant)`](doc/auth/oauth-2-implicit-grant.md)
144
+ * [`api_key (Custom Header Signature)`](doc/auth/custom-header-signature.md)
145
+
146
+ ## List of APIs
147
+
148
+ * [Pet](doc/controllers/pet.md)
149
+ * [Store](doc/controllers/store.md)
150
+ * [User](doc/controllers/user.md)
151
+
152
+ ## SDK Infrastructure
153
+
154
+ ### Configuration
155
+
156
+ * [ProxySettings](doc/proxy-settings.md)
157
+ * [Environment-Based Client Initialization](doc/environment-based-client-initialization.md)
158
+ * [AbstractLogger](doc/abstract-logger.md)
159
+ * [LoggingConfiguration](doc/logging-configuration.md)
160
+ * [RequestLoggingConfiguration](doc/request-logging-configuration.md)
161
+ * [ResponseLoggingConfiguration](doc/response-logging-configuration.md)
162
+
163
+ ### HTTP
164
+
165
+ * [HttpResponse](doc/http-response.md)
166
+ * [HttpRequest](doc/http-request.md)
167
+
168
+ ### Utilities
169
+
170
+ * [ApiResponse](doc/api-response.md)
171
+ * [ApiHelper](doc/api-helper.md)
172
+ * [DateTimeHelper](doc/date-time-helper.md)
173
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'swagger_petstore_open_api30'
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'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/1.5.0 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
+ end
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
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ end
@@ -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