wesley-key-sdk 2.0.1 → 3.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 +25 -67
- data/bin/console +4 -4
- data/lib/{swagger_petstore → cypress_test_api}/api_helper.rb +2 -2
- data/lib/cypress_test_api/client.rb +58 -0
- data/lib/{swagger_petstore → cypress_test_api}/configuration.rb +20 -61
- data/lib/cypress_test_api/controllers/api_controller.rb +102 -0
- data/lib/{swagger_petstore → cypress_test_api}/controllers/base_controller.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/exceptions/api_exception.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_call_back.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_method_enum.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_request.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_response.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/proxy_settings.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/models/base_model.rb +2 -2
- data/lib/cypress_test_api/models/custom_enum.rb +40 -0
- data/lib/{swagger_petstore/models/category2.rb → cypress_test_api/models/deer.rb} +18 -21
- data/lib/cypress_test_api/models/item.rb +166 -0
- data/lib/{swagger_petstore/models/category.rb → cypress_test_api/models/item_response.rb} +19 -10
- data/lib/cypress_test_api/models/lion.rb +68 -0
- data/lib/cypress_test_api/models/message.rb +68 -0
- data/lib/{swagger_petstore/models/api_response.rb → cypress_test_api/models/message2.rb} +14 -24
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +70 -0
- data/lib/cypress_test_api/models/nac_tag.rb +265 -0
- data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +44 -0
- data/lib/cypress_test_api/models/response_http400.rb +62 -0
- data/lib/{swagger_petstore/models/tag.rb → cypress_test_api/models/response_http404.rb} +9 -18
- data/lib/cypress_test_api/models/status11_enum.rb +40 -0
- data/lib/cypress_test_api/models/status1_enum.rb +40 -0
- data/lib/{swagger_petstore → cypress_test_api}/models/status_enum.rb +12 -12
- data/lib/cypress_test_api/models/tokens_request.rb +60 -0
- data/lib/{swagger_petstore → cypress_test_api}/utilities/date_time_helper.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/utilities/file_wrapper.rb +2 -2
- data/lib/cypress_test_api.rb +55 -0
- data/test/controllers/controller_test_base.rb +5 -14
- data/test/controllers/test_api_controller.rb +40 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +33 -40
- data/lib/swagger_petstore/client.rb +0 -95
- data/lib/swagger_petstore/controllers/pet_controller.rb +0 -206
- data/lib/swagger_petstore/controllers/store_controller.rb +0 -94
- data/lib/swagger_petstore/controllers/user_controller.rb +0 -165
- data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +0 -64
- data/lib/swagger_petstore/http/auth/api_key.rb +0 -52
- data/lib/swagger_petstore/http/auth/http_basic.rb +0 -62
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +0 -113
- data/lib/swagger_petstore/models/content_type_enum.rb +0 -26
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +0 -62
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +0 -36
- data/lib/swagger_petstore/models/o_auth_token.rb +0 -96
- data/lib/swagger_petstore/models/order.rb +0 -120
- data/lib/swagger_petstore/models/pet.rb +0 -117
- data/lib/swagger_petstore/models/pet_request.rb +0 -117
- data/lib/swagger_petstore/models/status1_enum.rb +0 -40
- data/lib/swagger_petstore/models/status2_enum.rb +0 -40
- data/lib/swagger_petstore/models/store_order_request.rb +0 -120
- data/lib/swagger_petstore/models/user.rb +0 -132
- data/lib/swagger_petstore/models/user_request.rb +0 -132
- data/lib/swagger_petstore.rb +0 -62
- data/test/controllers/test_store_controller.rb +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 129c6a174642565c4b46eda4800aa72627da66d4389716fe171915a04ff14bba
|
|
4
|
+
data.tar.gz: ee8a1bc576e5b408ea06e4d577f510d6428ca243f4b7c9816b3f47ff2a9faf7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2483e6bf28b22c4a3e4c4549c781e08bdee052782bc1a63055999bd291314d2a7a26125b7592b3d333f16b3624ba4aa58663f30c86a9161d08be69935775f19
|
|
7
|
+
data.tar.gz: b4831789c9c7569256425deb8f04dd48547082c0023d0eb47f4325e18d24da1430290310d36eb4eb7380647da1e16a30cd80779c31996e3814d554ad8e6037b4
|
data/README.md
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
# Getting Started with
|
|
2
|
+
# Getting Started with Cypress Test API
|
|
3
3
|
|
|
4
4
|
## Introduction
|
|
5
5
|
|
|
6
|
-
This is a sample
|
|
7
|
-
|
|
8
|
-
Find out more about Swagger: [http://swagger.io](http://swagger.io)
|
|
6
|
+
This is a sample API to demonstrate an OpenAPI spec with multiple endpoints and a custom model.
|
|
9
7
|
|
|
10
8
|
## Install the Package
|
|
11
9
|
|
|
12
10
|
Install the gem from the command line:
|
|
13
11
|
|
|
14
12
|
```bash
|
|
15
|
-
gem install wesley-key-sdk -v
|
|
13
|
+
gem install wesley-key-sdk -v 3.0.0
|
|
16
14
|
```
|
|
17
15
|
|
|
18
16
|
Or add the gem to your Gemfile and run `bundle`:
|
|
19
17
|
|
|
20
18
|
```ruby
|
|
21
|
-
gem 'wesley-key-sdk', '
|
|
19
|
+
gem 'wesley-key-sdk', '3.0.0'
|
|
22
20
|
```
|
|
23
21
|
|
|
24
|
-
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/
|
|
22
|
+
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/3.0.0).
|
|
25
23
|
|
|
26
24
|
## IRB Console Usage
|
|
27
25
|
|
|
@@ -38,8 +36,8 @@ irb
|
|
|
38
36
|
Now you can load the SDK in the IRB
|
|
39
37
|
|
|
40
38
|
```ruby
|
|
41
|
-
require '
|
|
42
|
-
include
|
|
39
|
+
require 'cypress_test_api'
|
|
40
|
+
include CypressTestApi
|
|
43
41
|
```
|
|
44
42
|
|
|
45
43
|
### 2. Use IRB within SDK
|
|
@@ -47,7 +45,7 @@ include SwaggerPetstore
|
|
|
47
45
|
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
48
46
|
|
|
49
47
|
```
|
|
50
|
-
cd path/to/
|
|
48
|
+
cd path/to/cypress_test_api
|
|
51
49
|
```
|
|
52
50
|
|
|
53
51
|
Now you can start the preconfigured irb console by running the following command
|
|
@@ -68,13 +66,13 @@ rake
|
|
|
68
66
|
|
|
69
67
|
## Initialize the API Client
|
|
70
68
|
|
|
71
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
69
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/client.md)
|
|
72
70
|
|
|
73
71
|
The following parameters are configurable for the API Client:
|
|
74
72
|
|
|
75
73
|
| Parameter | Type | Description |
|
|
76
74
|
| --- | --- | --- |
|
|
77
|
-
|
|
|
75
|
+
| default_host | `String` | *Default*: `'www.example.com'` |
|
|
78
76
|
| environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
|
79
77
|
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
80
78
|
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
@@ -85,92 +83,52 @@ The following parameters are configurable for the API Client:
|
|
|
85
83
|
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
86
84
|
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
87
85
|
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
88
|
-
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
89
|
-
| api_key_credentials | [`ApiKeyCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
|
|
90
|
-
| http_basic_credentials | [`HttpBasicCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |
|
|
91
|
-
| petstore_auth_credentials | [`PetstoreAuthCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/oauth-2-implicit-grant.md) | The credential object for OAuth 2 Implicit Grant |
|
|
86
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
92
87
|
|
|
93
88
|
The API client can be initialized as follows:
|
|
94
89
|
|
|
95
90
|
### Code-Based Client Initialization
|
|
96
91
|
|
|
97
92
|
```ruby
|
|
98
|
-
require '
|
|
99
|
-
include
|
|
93
|
+
require 'cypress_test_api'
|
|
94
|
+
include CypressTestApi
|
|
100
95
|
|
|
101
96
|
client = Client.new(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
api_key: 'api_key'
|
|
105
|
-
),
|
|
106
|
-
http_basic_credentials: HttpBasicCredentials.new(
|
|
107
|
-
username: 'username',
|
|
108
|
-
passwprd: 'passwprd'
|
|
109
|
-
),
|
|
110
|
-
petstore_auth_credentials: PetstoreAuthCredentials.new(
|
|
111
|
-
o_auth_client_id: 'OAuthClientId',
|
|
112
|
-
o_auth_redirect_uri: 'OAuthRedirectUri',
|
|
113
|
-
o_auth_scopes: [
|
|
114
|
-
OAuthScopePetstoreAuthEnum::READPETS,
|
|
115
|
-
OAuthScopePetstoreAuthEnum::WRITEPETS
|
|
116
|
-
]
|
|
117
|
-
),
|
|
118
|
-
environment: Environment::PRODUCTION
|
|
97
|
+
environment: Environment::PRODUCTION,
|
|
98
|
+
default_host: 'www.example.com'
|
|
119
99
|
)
|
|
120
100
|
```
|
|
121
101
|
|
|
122
102
|
### Environment-Based Client Initialization
|
|
123
103
|
|
|
124
104
|
```ruby
|
|
125
|
-
require '
|
|
126
|
-
include
|
|
105
|
+
require 'cypress_test_api'
|
|
106
|
+
include CypressTestApi
|
|
127
107
|
|
|
128
108
|
# Create client from environment
|
|
129
109
|
client = Client.from_env
|
|
130
110
|
```
|
|
131
111
|
|
|
132
|
-
See the [`Environment-Based Client Initialization`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
133
|
-
|
|
134
|
-
## Environments
|
|
135
|
-
|
|
136
|
-
The SDK can be configured to use a different environment for making API calls. Available environments are:
|
|
137
|
-
|
|
138
|
-
### Fields
|
|
139
|
-
|
|
140
|
-
| Name | Description |
|
|
141
|
-
| --- | --- |
|
|
142
|
-
| production | **Default** |
|
|
143
|
-
| environment2 | - |
|
|
144
|
-
| environment3 | - |
|
|
145
|
-
|
|
146
|
-
## Authorization
|
|
147
|
-
|
|
148
|
-
This API uses the following authentication schemes.
|
|
149
|
-
|
|
150
|
-
* [`api_key (Custom Header Signature)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/custom-header-signature.md)
|
|
151
|
-
* [`httpBasic (Basic Authentication)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/basic-authentication.md)
|
|
152
|
-
* [`petstore_auth (OAuth 2 Implicit Grant)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/auth/oauth-2-implicit-grant.md)
|
|
112
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/environment-based-client-initialization.md) section for details.
|
|
153
113
|
|
|
154
114
|
## List of APIs
|
|
155
115
|
|
|
156
|
-
* [
|
|
157
|
-
* [Store](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/controllers/store.md)
|
|
158
|
-
* [User](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/2.0.1/doc/controllers/user.md)
|
|
116
|
+
* [API](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/controllers/api.md)
|
|
159
117
|
|
|
160
118
|
## SDK Infrastructure
|
|
161
119
|
|
|
162
120
|
### Configuration
|
|
163
121
|
|
|
164
|
-
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
165
|
-
* [Environment-Based Client Initialization](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
122
|
+
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/proxy-settings.md)
|
|
123
|
+
* [Environment-Based Client Initialization](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/environment-based-client-initialization.md)
|
|
166
124
|
|
|
167
125
|
### HTTP
|
|
168
126
|
|
|
169
|
-
* [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
170
|
-
* [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
127
|
+
* [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/http-response.md)
|
|
128
|
+
* [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/http-request.md)
|
|
171
129
|
|
|
172
130
|
### Utilities
|
|
173
131
|
|
|
174
|
-
* [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
175
|
-
* [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/
|
|
132
|
+
* [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/api-helper.md)
|
|
133
|
+
* [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/3.0.0/doc/date-time-helper.md)
|
|
176
134
|
|
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 'cypress_test_api'
|
|
8
8
|
|
|
9
|
-
puts '
|
|
10
|
-
puts 'You can now create a client with: client =
|
|
11
|
-
puts 'Or use from_env: client =
|
|
9
|
+
puts 'CypressTestApi SDK loaded!'
|
|
10
|
+
puts 'You can now create a client with: client = CypressTestApi::Client.new'
|
|
11
|
+
puts 'Or use from_env: client = CypressTestApi::Client.from_env'
|
|
12
12
|
|
|
13
13
|
# Start an interactive IRB session
|
|
14
14
|
require 'irb'
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# cypress_test_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module CypressTestApi
|
|
7
|
+
# cypress_test_api client class.
|
|
8
|
+
class Client
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_reader :config
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Access to client controller.
|
|
17
|
+
# @return [APIController] Returns the controller instance.
|
|
18
|
+
def client
|
|
19
|
+
@client ||= APIController.new @global_configuration
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize(
|
|
23
|
+
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
24
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
25
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
26
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
27
|
+
environment: Environment::PRODUCTION, default_host: 'www.example.com',
|
|
28
|
+
config: nil
|
|
29
|
+
)
|
|
30
|
+
@config = if config.nil?
|
|
31
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
32
|
+
timeout: timeout, max_retries: max_retries,
|
|
33
|
+
retry_interval: retry_interval,
|
|
34
|
+
backoff_factor: backoff_factor,
|
|
35
|
+
retry_statuses: retry_statuses,
|
|
36
|
+
retry_methods: retry_methods,
|
|
37
|
+
http_callback: http_callback,
|
|
38
|
+
proxy_settings: proxy_settings,
|
|
39
|
+
environment: environment,
|
|
40
|
+
default_host: default_host)
|
|
41
|
+
else
|
|
42
|
+
config
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
46
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
|
47
|
+
.global_errors(BaseController::GLOBAL_ERRORS)
|
|
48
|
+
.user_agent(BaseController.user_agent)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Creates a client directly from environment variables.
|
|
52
|
+
def self.from_env(**overrides)
|
|
53
|
+
default_config = Configuration.build_default_config_from_env
|
|
54
|
+
new_config = default_config.clone_with(**overrides)
|
|
55
|
+
new(config: new_config)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# An enum for SDK environments.
|
|
8
8
|
class Environment
|
|
9
9
|
ENVIRONMENT = [
|
|
10
|
-
PRODUCTION = 'production'.freeze
|
|
11
|
-
ENVIRONMENT2 = 'environment2'.freeze,
|
|
12
|
-
ENVIRONMENT3 = 'environment3'.freeze
|
|
10
|
+
PRODUCTION = 'production'.freeze
|
|
13
11
|
].freeze
|
|
14
12
|
|
|
15
13
|
# Converts a string or symbol into a valid Environment constant.
|
|
16
14
|
def self.from_value(value, default_value = PRODUCTION)
|
|
17
15
|
return default_value if value.nil?
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
case str
|
|
21
|
-
when 'production' then PRODUCTION
|
|
22
|
-
when 'environment2' then ENVIRONMENT2
|
|
23
|
-
when 'environment3' then ENVIRONMENT3
|
|
24
|
-
|
|
25
|
-
else
|
|
26
|
-
warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
|
|
27
|
-
default_value
|
|
28
|
-
end
|
|
17
|
+
default_value
|
|
29
18
|
end
|
|
30
19
|
end
|
|
31
20
|
|
|
@@ -47,8 +36,7 @@ module SwaggerPetstore
|
|
|
47
36
|
# are configured in this class.
|
|
48
37
|
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
49
38
|
# The attribute readers for properties.
|
|
50
|
-
attr_reader :environment, :
|
|
51
|
-
:petstore_auth_credentials, :test_header
|
|
39
|
+
attr_reader :environment, :default_host
|
|
52
40
|
|
|
53
41
|
class << self
|
|
54
42
|
attr_reader :environments
|
|
@@ -59,9 +47,7 @@ module SwaggerPetstore
|
|
|
59
47
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
60
48
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
61
49
|
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
62
|
-
environment: Environment::PRODUCTION,
|
|
63
|
-
http_basic_credentials: nil, petstore_auth_credentials: nil,
|
|
64
|
-
test_header: 'TestHeaderDefaultValue'
|
|
50
|
+
environment: Environment::PRODUCTION, default_host: 'www.example.com'
|
|
65
51
|
)
|
|
66
52
|
super connection: connection, adapter: adapter, timeout: timeout,
|
|
67
53
|
max_retries: max_retries, retry_interval: retry_interval,
|
|
@@ -72,17 +58,8 @@ module SwaggerPetstore
|
|
|
72
58
|
# Current API environment
|
|
73
59
|
@environment = String(environment)
|
|
74
60
|
|
|
75
|
-
#
|
|
76
|
-
@
|
|
77
|
-
|
|
78
|
-
# The object holding Basic Authentication credentials
|
|
79
|
-
@http_basic_credentials = http_basic_credentials
|
|
80
|
-
|
|
81
|
-
# The object holding OAuth 2 Implicit Grant credentials
|
|
82
|
-
@petstore_auth_credentials = petstore_auth_credentials
|
|
83
|
-
|
|
84
|
-
# This is a test header
|
|
85
|
-
@test_header = test_header
|
|
61
|
+
# defaultHost value
|
|
62
|
+
@default_host = default_host
|
|
86
63
|
|
|
87
64
|
# The Http Client to use for making requests.
|
|
88
65
|
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
@@ -91,9 +68,7 @@ module SwaggerPetstore
|
|
|
91
68
|
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
92
69
|
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
93
70
|
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
94
|
-
proxy_settings: nil, environment: nil,
|
|
95
|
-
api_key_credentials: nil, http_basic_credentials: nil,
|
|
96
|
-
petstore_auth_credentials: nil, test_header: nil)
|
|
71
|
+
proxy_settings: nil, environment: nil, default_host: nil)
|
|
97
72
|
connection ||= self.connection
|
|
98
73
|
adapter ||= self.adapter
|
|
99
74
|
timeout ||= self.timeout
|
|
@@ -105,10 +80,7 @@ module SwaggerPetstore
|
|
|
105
80
|
http_callback ||= self.http_callback
|
|
106
81
|
proxy_settings ||= self.proxy_settings
|
|
107
82
|
environment ||= self.environment
|
|
108
|
-
|
|
109
|
-
http_basic_credentials ||= self.http_basic_credentials
|
|
110
|
-
petstore_auth_credentials ||= self.petstore_auth_credentials
|
|
111
|
-
test_header ||= self.test_header
|
|
83
|
+
default_host ||= self.default_host
|
|
112
84
|
|
|
113
85
|
Configuration.new(connection: connection, adapter: adapter,
|
|
114
86
|
timeout: timeout, max_retries: max_retries,
|
|
@@ -118,24 +90,14 @@ module SwaggerPetstore
|
|
|
118
90
|
retry_methods: retry_methods,
|
|
119
91
|
http_callback: http_callback,
|
|
120
92
|
proxy_settings: proxy_settings,
|
|
121
|
-
environment: environment,
|
|
122
|
-
api_key_credentials: api_key_credentials,
|
|
123
|
-
http_basic_credentials: http_basic_credentials,
|
|
124
|
-
petstore_auth_credentials: petstore_auth_credentials,
|
|
125
|
-
test_header: test_header)
|
|
93
|
+
environment: environment, default_host: default_host)
|
|
126
94
|
end
|
|
127
95
|
|
|
128
96
|
|
|
129
97
|
# All the environments the SDK can run in.
|
|
130
98
|
ENVIRONMENTS = {
|
|
131
99
|
Environment::PRODUCTION => {
|
|
132
|
-
Server::DEFAULT => 'https://
|
|
133
|
-
},
|
|
134
|
-
Environment::ENVIRONMENT2 => {
|
|
135
|
-
Server::DEFAULT => 'http://petstore.swagger.io/v2'
|
|
136
|
-
},
|
|
137
|
-
Environment::ENVIRONMENT3 => {
|
|
138
|
-
Server::DEFAULT => 'https://petstore.swagger.io/oauth'
|
|
100
|
+
Server::DEFAULT => 'https://{defaultHost}'
|
|
139
101
|
}
|
|
140
102
|
}.freeze
|
|
141
103
|
|
|
@@ -144,14 +106,19 @@ module SwaggerPetstore
|
|
|
144
106
|
# required.
|
|
145
107
|
# @return [String] The base URI.
|
|
146
108
|
def get_base_uri(server = Server::DEFAULT)
|
|
147
|
-
|
|
109
|
+
parameters = {
|
|
110
|
+
'defaultHost' => { 'value' => default_host, 'encode' => false }
|
|
111
|
+
}
|
|
112
|
+
APIHelper.append_url_with_template_parameters(
|
|
113
|
+
ENVIRONMENTS[environment][server], parameters
|
|
114
|
+
)
|
|
148
115
|
end
|
|
149
116
|
|
|
150
117
|
# Builds a Configuration instance using environment variables.
|
|
151
118
|
def self.build_default_config_from_env
|
|
152
119
|
# === Core environment ===
|
|
153
120
|
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
154
|
-
|
|
121
|
+
default_host = ENV.fetch('DEFAULT_HOST', 'www.example.com')
|
|
155
122
|
timeout = (ENV['TIMEOUT'] || 60).to_f
|
|
156
123
|
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
157
124
|
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
@@ -170,26 +137,18 @@ module SwaggerPetstore
|
|
|
170
137
|
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
171
138
|
end
|
|
172
139
|
|
|
173
|
-
# === Authentication credentials ===
|
|
174
|
-
api_key_credentials = ApiKeyCredentials.from_env
|
|
175
|
-
http_basic_credentials = HttpBasicCredentials.from_env
|
|
176
|
-
petstore_auth_credentials = PetstoreAuthCredentials.from_env
|
|
177
|
-
|
|
178
140
|
# === Proxy settings ===
|
|
179
141
|
proxy_settings = ProxySettings.from_env
|
|
180
142
|
|
|
181
143
|
Configuration.new(
|
|
182
144
|
environment: environment,
|
|
183
|
-
|
|
145
|
+
default_host: default_host,
|
|
184
146
|
timeout: timeout,
|
|
185
147
|
max_retries: max_retries,
|
|
186
148
|
retry_interval: retry_interval,
|
|
187
149
|
backoff_factor: backoff_factor,
|
|
188
150
|
retry_statuses: retry_statuses,
|
|
189
151
|
retry_methods: retry_methods,
|
|
190
|
-
api_key_credentials: api_key_credentials,
|
|
191
|
-
http_basic_credentials: http_basic_credentials,
|
|
192
|
-
petstore_auth_credentials: petstore_auth_credentials,
|
|
193
152
|
proxy_settings: proxy_settings
|
|
194
153
|
)
|
|
195
154
|
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# cypress_test_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
+
# ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module CypressTestApi
|
|
7
|
+
# APIController
|
|
8
|
+
class APIController < BaseController
|
|
9
|
+
# Creates a new resource in the system.
|
|
10
|
+
# @param [Status11Enum] status Required parameter: The status of the items
|
|
11
|
+
# to filter by.
|
|
12
|
+
# @param [Item] body Optional parameter: Custom model with additional
|
|
13
|
+
# properties
|
|
14
|
+
# @return [Object] Response from the API call.
|
|
15
|
+
def createanitem(status,
|
|
16
|
+
body: nil)
|
|
17
|
+
@api_call
|
|
18
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
19
|
+
'/items/{status}',
|
|
20
|
+
Server::DEFAULT)
|
|
21
|
+
.template_param(new_parameter(status, key: 'status')
|
|
22
|
+
.should_encode(true))
|
|
23
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
24
|
+
.body_param(new_parameter(body))
|
|
25
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
26
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
|
27
|
+
.response(new_response_handler
|
|
28
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
|
29
|
+
.local_error('400',
|
|
30
|
+
'Bad Syntax',
|
|
31
|
+
APIException)
|
|
32
|
+
.local_error('401',
|
|
33
|
+
'Unauthorized',
|
|
34
|
+
APIException)
|
|
35
|
+
.local_error('403',
|
|
36
|
+
'Permission Denied',
|
|
37
|
+
APIException))
|
|
38
|
+
.execute
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# TODO: type endpoint description here
|
|
42
|
+
# @param [String] id Required parameter: The ID of the item to retrieve
|
|
43
|
+
# @param [String] value Required parameter: The value of the item to
|
|
44
|
+
# retrieve
|
|
45
|
+
# @return [Item] Response from the API call.
|
|
46
|
+
def getanitemby_id(id,
|
|
47
|
+
value)
|
|
48
|
+
@api_call
|
|
49
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
50
|
+
'/items/{id}',
|
|
51
|
+
Server::DEFAULT)
|
|
52
|
+
.template_param(new_parameter(id, key: 'id')
|
|
53
|
+
.should_encode(true))
|
|
54
|
+
.query_param(new_parameter(value, key: 'value'))
|
|
55
|
+
.header_param(new_parameter('application/json', key: 'accept')))
|
|
56
|
+
.response(new_response_handler
|
|
57
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
58
|
+
.deserialize_into(Item.method(:from_hash)))
|
|
59
|
+
.execute
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Generates a new OAuth token with the specified scopes.
|
|
63
|
+
# @param [TokensRequest] body Optional parameter: TODO: type description
|
|
64
|
+
# here
|
|
65
|
+
# @return [void] Response from the API call.
|
|
66
|
+
def create_o_auth_token(body: nil)
|
|
67
|
+
@api_call
|
|
68
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
69
|
+
'/tokens',
|
|
70
|
+
Server::DEFAULT)
|
|
71
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
72
|
+
.body_param(new_parameter(body))
|
|
73
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
|
74
|
+
.response(new_response_handler
|
|
75
|
+
.is_response_void(true)
|
|
76
|
+
.local_error('400',
|
|
77
|
+
'Bad request',
|
|
78
|
+
APIException))
|
|
79
|
+
.execute
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# This endpoint accepts a complex structure with multiple arrays.
|
|
83
|
+
# @param [MultipleArraysRequest] body Optional parameter: TODO: type
|
|
84
|
+
# description here
|
|
85
|
+
# @return [void] Response from the API call.
|
|
86
|
+
def test_endpointwith_arrays(body: nil)
|
|
87
|
+
@api_call
|
|
88
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
89
|
+
'/multiple-arrays',
|
|
90
|
+
Server::DEFAULT)
|
|
91
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
92
|
+
.body_param(new_parameter(body))
|
|
93
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
|
94
|
+
.response(new_response_handler
|
|
95
|
+
.is_response_void(true)
|
|
96
|
+
.local_error('400',
|
|
97
|
+
'Bad request',
|
|
98
|
+
APIException))
|
|
99
|
+
.execute
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# Class for exceptions when there is a network error, status code error, etc.
|
|
8
8
|
class APIException < CoreLibrary::ApiException
|
|
9
9
|
# Provides a human-readable string representation of the object.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
8
|
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# HTTP Methods Enumeration.
|
|
8
8
|
class HttpMethodEnum < CoreLibrary::HttpMethod
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# Represents a single Http Request.
|
|
8
8
|
class HttpRequest < CoreLibrary::HttpRequest
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# Http response received.
|
|
8
8
|
class HttpResponse < CoreLibrary::HttpResponse
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
##
|
|
8
8
|
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
9
|
# including optional basic authentication.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress_test_api
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module CypressTestApi
|
|
7
7
|
# Base model.
|
|
8
8
|
# rubocop:disable all
|
|
9
9
|
class BaseModel < CoreLibrary::BaseModel
|