chainlink-apimatic-sdk 0.0.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 (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +181 -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 +94 -0
  11. data/lib/swagger_petstore_open_api30/configuration.rb +180 -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 +123 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5929dd7a18b6de3b65d9ebb4b9cc92dbb2bf7712578d6cee5412257c2081b7f8
4
+ data.tar.gz: 6453adf7bfc7e5d1de00bc451727cab73dcf00a9cf28bbd670cdf245bea9dda9
5
+ SHA512:
6
+ metadata.gz: 199c9664401cdfa2bde086162a6a33b107ff3589aa1565d8626750ce8a6775d2e627157429462fdb9de3f81d761de1e0339ba52e135f48d3743d112c23b82168
7
+ data.tar.gz: 2e3d20c95f59b1d4f63143ad1814396cb31343c250da8ebf04c04a36c5ad79cf535957d02d41e36728e9d0c57c861c1fb38aaa2365459f14b30bfcf96707bb4a
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,181 @@
1
+
2
+ # Getting Started with Swagger Petstore - OpenAPI 3.0
3
+
4
+ ## Introduction
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.
10
+
11
+ Some useful links:
12
+
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)
15
+
16
+ Find out more about Swagger: [https://swagger.io](https://swagger.io)
17
+
18
+ ## Install the Package
19
+
20
+ Install the gem from the command line:
21
+
22
+ ```bash
23
+ gem install chainlink-apimatic-sdk -v 0.0.1
24
+ ```
25
+
26
+ Or add the gem to your Gemfile and run `bundle`:
27
+
28
+ ```ruby
29
+ gem 'chainlink-apimatic-sdk', '0.0.1'
30
+ ```
31
+
32
+ For additional gem details, see the [RubyGems page for the chainlink-apimatic-sdk gem](https://rubygems.org/gems/chainlink-apimatic-sdk/versions/0.0.1).
33
+
34
+ ## IRB Console Usage
35
+
36
+ You can explore the SDK interactively using IRB in two ways
37
+
38
+ ### 1. Use IRB with Installed Gem
39
+
40
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
41
+
42
+ ```bash
43
+ irb
44
+ ```
45
+
46
+ Now you can load the SDK in the IRB
47
+
48
+ ```ruby
49
+ require 'swagger_petstore_open_api30'
50
+ include SwaggerPetstoreOpenApi30
51
+ ```
52
+
53
+ ### 2. Use IRB within SDK
54
+
55
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
56
+
57
+ ```
58
+ cd path/to/swagger_petstore_open_api30
59
+ ```
60
+
61
+ Now you can start the preconfigured irb console by running the following command
62
+
63
+ ```bash
64
+ ruby bin/console
65
+ ```
66
+
67
+ **_Note:_** This automatically loads the SDK from lib/
68
+
69
+ ## Initialize the API Client
70
+
71
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/client.md)
72
+
73
+ The following parameters are configurable for the API Client:
74
+
75
+ | Parameter | Type | Description |
76
+ | --- | --- | --- |
77
+ | environment | [`Environment`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
78
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
79
+ | 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** |
81
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
82
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
83
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
84
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
85
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
86
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
87
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
88
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
89
+ | petstore_auth_credentials | [`PetstoreAuthCredentials`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-implicit-grant.md) | The credential object for OAuth 2 Implicit Grant |
90
+ | api_key_credentials | [`ApiKeyCredentials`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
91
+
92
+ The API client can be initialized as follows:
93
+
94
+ ### Code-Based Client Initialization
95
+
96
+ ```ruby
97
+ require 'swagger_petstore_open_api30'
98
+ include SwaggerPetstoreOpenApi30
99
+
100
+ 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
+ api_key_credentials: ApiKeyCredentials.new(
110
+ api_key: 'api_key'
111
+ ),
112
+ environment: Environment::PRODUCTION,
113
+ logging_configuration: LoggingConfiguration.new(
114
+ log_level: Logger::INFO,
115
+ request_logging_config: RequestLoggingConfiguration.new(
116
+ log_body: true
117
+ ),
118
+ response_logging_config: ResponseLoggingConfiguration.new(
119
+ log_headers: true
120
+ )
121
+ )
122
+ )
123
+ ```
124
+
125
+ ### Environment-Based Client Initialization
126
+
127
+ ```ruby
128
+ require 'swagger_petstore_open_api30'
129
+ include SwaggerPetstoreOpenApi30
130
+
131
+ # Create client from environment
132
+ client = Client.from_env
133
+ ```
134
+
135
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
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
+
147
+ ## Authorization
148
+
149
+ This API uses the following authentication schemes.
150
+
151
+ * [`petstore_auth (OAuth 2 Implicit Grant)`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-implicit-grant.md)
152
+ * [`api_key (Custom Header Signature)`](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/auth/custom-header-signature.md)
153
+
154
+ ## List of APIs
155
+
156
+ * [Pet](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/pet.md)
157
+ * [Store](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/store.md)
158
+ * [User](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/user.md)
159
+
160
+ ## SDK Infrastructure
161
+
162
+ ### Configuration
163
+
164
+ * [ProxySettings](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
165
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
166
+ * [AbstractLogger](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
167
+ * [LoggingConfiguration](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
168
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
169
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
170
+
171
+ ### HTTP
172
+
173
+ * [HttpResponse](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/http-response.md)
174
+ * [HttpRequest](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/http-request.md)
175
+
176
+ ### Utilities
177
+
178
+ * [ApiResponse](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/api-response.md)
179
+ * [ApiHelper](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/api-helper.md)
180
+ * [DateTimeHelper](https://www.github.com/sdks-io/chainlink-apimatic-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
181
+
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/0.0.1 (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