wesley-key-sdk 0.1.3 → 0.1.6
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 +65 -57
- data/bin/console +15 -0
- data/lib/{swagger_petstore → cypress_test_api}/api_helper.rb +2 -2
- data/lib/cypress_test_api/client.rb +58 -0
- data/lib/cypress_test_api/configuration.rb +156 -0
- 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/cypress_test_api/http/proxy_settings.rb +22 -0
- 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/category.rb → cypress_test_api/models/deer.rb} +18 -21
- data/lib/cypress_test_api/models/item.rb +166 -0
- data/lib/{swagger_petstore/models/category2.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/cypress_test_api/models/status_enum.rb +40 -0
- 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 -19
- data/test/controllers/test_api_controller.rb +40 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +39 -45
- data/lib/swagger_petstore/client.rb +0 -84
- data/lib/swagger_petstore/configuration.rb +0 -127
- 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 -42
- data/lib/swagger_petstore/http/auth/http_basic.rb +0 -50
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +0 -98
- data/lib/swagger_petstore/http/proxy_settings.rb +0 -13
- data/lib/swagger_petstore/models/content_type_enum.rb +0 -20
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +0 -45
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +0 -23
- 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 -26
- data/lib/swagger_petstore/models/status2_enum.rb +0 -26
- data/lib/swagger_petstore/models/status_enum.rb +0 -26
- 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: c8ccc80876b4bddcfbd2f5bba54cb4d9bab55f7de0b0d0b078deabf3e24ff149
|
|
4
|
+
data.tar.gz: 9b0b9ebcb2e165727b56be888eaf36481cc75827e12459a03bc828c7466d86e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69b5c83b7d2c862d2db646fac6a28062e91c4f971958236381fa9b200abf37a68f42cf1e2ec5c789ffe980416ff78b9e6f0f70d6bf91721f60ba9124041d3c1b
|
|
7
|
+
data.tar.gz: 45d2b0d8c3c4cea9919c2585e094356e3a52015afc72645bc3f581d7661f1d500adb4a60a13839122421a166da56c7de37b3302c149f1ca14a7370e200a6f791
|
data/README.md
CHANGED
|
@@ -1,27 +1,60 @@
|
|
|
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 0.1.
|
|
13
|
+
gem install wesley-key-sdk -v 0.1.6
|
|
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', '0.1.
|
|
19
|
+
gem 'wesley-key-sdk', '0.1.6'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/0.1.6).
|
|
23
|
+
|
|
24
|
+
## IRB Console Usage
|
|
25
|
+
|
|
26
|
+
You can explore the SDK interactively using IRB in two ways
|
|
27
|
+
|
|
28
|
+
### 1. Use IRB with Installed Gem
|
|
29
|
+
|
|
30
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
irb
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Now you can load the SDK in the IRB
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
require 'cypress_test_api'
|
|
40
|
+
include CypressTestApi
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Use IRB within SDK
|
|
44
|
+
|
|
45
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
cd path/to/cypress_test_api
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can start the preconfigured irb console by running the following command
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
ruby bin/console
|
|
22
55
|
```
|
|
23
56
|
|
|
24
|
-
|
|
57
|
+
**_Note:_** This automatically loads the SDK from lib/
|
|
25
58
|
|
|
26
59
|
## Test the SDK
|
|
27
60
|
|
|
@@ -33,13 +66,13 @@ rake
|
|
|
33
66
|
|
|
34
67
|
## Initialize the API Client
|
|
35
68
|
|
|
36
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
69
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/client.md)
|
|
37
70
|
|
|
38
71
|
The following parameters are configurable for the API Client:
|
|
39
72
|
|
|
40
73
|
| Parameter | Type | Description |
|
|
41
74
|
| --- | --- | --- |
|
|
42
|
-
|
|
|
75
|
+
| default_host | `String` | *Default*: `'www.example.com'` |
|
|
43
76
|
| environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
|
44
77
|
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
45
78
|
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
@@ -50,77 +83,52 @@ The following parameters are configurable for the API Client:
|
|
|
50
83
|
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
51
84
|
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
52
85
|
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
53
|
-
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
54
|
-
| api_key_credentials | [`ApiKeyCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.3/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
|
|
55
|
-
| http_basic_credentials | [`HttpBasicCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.3/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |
|
|
56
|
-
| petstore_auth_credentials | [`PetstoreAuthCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.3/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/0.1.6/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
57
87
|
|
|
58
88
|
The API client can be initialized as follows:
|
|
59
89
|
|
|
90
|
+
### Code-Based Client Initialization
|
|
91
|
+
|
|
60
92
|
```ruby
|
|
61
|
-
require '
|
|
62
|
-
include
|
|
93
|
+
require 'cypress_test_api'
|
|
94
|
+
include CypressTestApi
|
|
63
95
|
|
|
64
96
|
client = Client.new(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
api_key: 'api_key'
|
|
68
|
-
),
|
|
69
|
-
http_basic_credentials: HttpBasicCredentials.new(
|
|
70
|
-
username: 'username',
|
|
71
|
-
passwprd: 'passwprd'
|
|
72
|
-
),
|
|
73
|
-
petstore_auth_credentials: PetstoreAuthCredentials.new(
|
|
74
|
-
o_auth_client_id: 'OAuthClientId',
|
|
75
|
-
o_auth_redirect_uri: 'OAuthRedirectUri',
|
|
76
|
-
o_auth_scopes: [
|
|
77
|
-
OAuthScopePetstoreAuthEnum::READPETS,
|
|
78
|
-
OAuthScopePetstoreAuthEnum::WRITEPETS
|
|
79
|
-
]
|
|
80
|
-
),
|
|
81
|
-
environment: Environment::PRODUCTION
|
|
97
|
+
environment: Environment::PRODUCTION,
|
|
98
|
+
default_host: 'www.example.com'
|
|
82
99
|
)
|
|
83
100
|
```
|
|
84
101
|
|
|
85
|
-
|
|
102
|
+
### Environment-Based Client Initialization
|
|
86
103
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
| Name | Description |
|
|
92
|
-
| --- | --- |
|
|
93
|
-
| production | **Default** |
|
|
94
|
-
| environment2 | - |
|
|
95
|
-
| environment3 | - |
|
|
96
|
-
|
|
97
|
-
## Authorization
|
|
98
|
-
|
|
99
|
-
This API uses the following authentication schemes.
|
|
104
|
+
```ruby
|
|
105
|
+
require 'cypress_test_api'
|
|
106
|
+
include CypressTestApi
|
|
100
107
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
# Create client from environment
|
|
109
|
+
client = Client.from_env
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/environment-based-client-initialization.md) section for details.
|
|
104
113
|
|
|
105
114
|
## List of APIs
|
|
106
115
|
|
|
107
|
-
* [
|
|
108
|
-
* [Store](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.3/doc/controllers/store.md)
|
|
109
|
-
* [User](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.3/doc/controllers/user.md)
|
|
116
|
+
* [API](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/controllers/api.md)
|
|
110
117
|
|
|
111
118
|
## SDK Infrastructure
|
|
112
119
|
|
|
113
120
|
### Configuration
|
|
114
121
|
|
|
115
|
-
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
122
|
+
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/proxy-settings.md)
|
|
123
|
+
* [Environment-Based Client Initialization](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/environment-based-client-initialization.md)
|
|
116
124
|
|
|
117
125
|
### HTTP
|
|
118
126
|
|
|
119
|
-
* [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
120
|
-
* [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
127
|
+
* [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/http-response.md)
|
|
128
|
+
* [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/http-request.md)
|
|
121
129
|
|
|
122
130
|
### Utilities
|
|
123
131
|
|
|
124
|
-
* [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
125
|
-
* [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
132
|
+
* [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/api-helper.md)
|
|
133
|
+
* [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/date-time-helper.md)
|
|
126
134
|
|
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 'cypress_test_api'
|
|
8
|
+
|
|
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
|
+
|
|
13
|
+
# Start an interactive IRB session
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start
|
|
@@ -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
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
# An enum for SDK environments.
|
|
8
|
+
class Environment
|
|
9
|
+
ENVIRONMENT = [
|
|
10
|
+
PRODUCTION = 'production'.freeze
|
|
11
|
+
].freeze
|
|
12
|
+
|
|
13
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
14
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
15
|
+
return default_value if value.nil?
|
|
16
|
+
|
|
17
|
+
default_value
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# An enum for API servers.
|
|
22
|
+
class Server
|
|
23
|
+
SERVER = [
|
|
24
|
+
DEFAULT = 'default'.freeze
|
|
25
|
+
].freeze
|
|
26
|
+
|
|
27
|
+
# Converts a string or symbol into a valid Server constant.
|
|
28
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
29
|
+
return default_value if value.nil?
|
|
30
|
+
|
|
31
|
+
default_value
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# All configuration including auth info and base URI for the API access
|
|
36
|
+
# are configured in this class.
|
|
37
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
38
|
+
# The attribute readers for properties.
|
|
39
|
+
attr_reader :environment, :default_host
|
|
40
|
+
|
|
41
|
+
class << self
|
|
42
|
+
attr_reader :environments
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize(
|
|
46
|
+
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
47
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
48
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
49
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
50
|
+
environment: Environment::PRODUCTION, default_host: 'www.example.com'
|
|
51
|
+
)
|
|
52
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
53
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
54
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
55
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
56
|
+
proxy_settings: proxy_settings
|
|
57
|
+
|
|
58
|
+
# Current API environment
|
|
59
|
+
@environment = String(environment)
|
|
60
|
+
|
|
61
|
+
# defaultHost value
|
|
62
|
+
@default_host = default_host
|
|
63
|
+
|
|
64
|
+
# The Http Client to use for making requests.
|
|
65
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
69
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
70
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
71
|
+
proxy_settings: nil, environment: nil, default_host: nil)
|
|
72
|
+
connection ||= self.connection
|
|
73
|
+
adapter ||= self.adapter
|
|
74
|
+
timeout ||= self.timeout
|
|
75
|
+
max_retries ||= self.max_retries
|
|
76
|
+
retry_interval ||= self.retry_interval
|
|
77
|
+
backoff_factor ||= self.backoff_factor
|
|
78
|
+
retry_statuses ||= self.retry_statuses
|
|
79
|
+
retry_methods ||= self.retry_methods
|
|
80
|
+
http_callback ||= self.http_callback
|
|
81
|
+
proxy_settings ||= self.proxy_settings
|
|
82
|
+
environment ||= self.environment
|
|
83
|
+
default_host ||= self.default_host
|
|
84
|
+
|
|
85
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
86
|
+
timeout: timeout, max_retries: max_retries,
|
|
87
|
+
retry_interval: retry_interval,
|
|
88
|
+
backoff_factor: backoff_factor,
|
|
89
|
+
retry_statuses: retry_statuses,
|
|
90
|
+
retry_methods: retry_methods,
|
|
91
|
+
http_callback: http_callback,
|
|
92
|
+
proxy_settings: proxy_settings,
|
|
93
|
+
environment: environment, default_host: default_host)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# All the environments the SDK can run in.
|
|
98
|
+
ENVIRONMENTS = {
|
|
99
|
+
Environment::PRODUCTION => {
|
|
100
|
+
Server::DEFAULT => 'https://{defaultHost}'
|
|
101
|
+
}
|
|
102
|
+
}.freeze
|
|
103
|
+
|
|
104
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
105
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
106
|
+
# required.
|
|
107
|
+
# @return [String] The base URI.
|
|
108
|
+
def get_base_uri(server = Server::DEFAULT)
|
|
109
|
+
parameters = {
|
|
110
|
+
'defaultHost' => { 'value' => default_host, 'encode' => false }
|
|
111
|
+
}
|
|
112
|
+
APIHelper.append_url_with_template_parameters(
|
|
113
|
+
ENVIRONMENTS[environment][server], parameters
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Builds a Configuration instance using environment variables.
|
|
118
|
+
def self.build_default_config_from_env
|
|
119
|
+
# === Core environment ===
|
|
120
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
121
|
+
default_host = ENV.fetch('DEFAULT_HOST', 'www.example.com')
|
|
122
|
+
timeout = (ENV['TIMEOUT'] || 60).to_f
|
|
123
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
124
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
125
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
126
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
127
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
128
|
+
.split(',')
|
|
129
|
+
.map(&:strip)
|
|
130
|
+
.map do |item|
|
|
131
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
132
|
+
end
|
|
133
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
|
|
134
|
+
.split(',')
|
|
135
|
+
.map(&:strip)
|
|
136
|
+
.map do |item|
|
|
137
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# === Proxy settings ===
|
|
141
|
+
proxy_settings = ProxySettings.from_env
|
|
142
|
+
|
|
143
|
+
Configuration.new(
|
|
144
|
+
environment: environment,
|
|
145
|
+
default_host: default_host,
|
|
146
|
+
timeout: timeout,
|
|
147
|
+
max_retries: max_retries,
|
|
148
|
+
retry_interval: retry_interval,
|
|
149
|
+
backoff_factor: backoff_factor,
|
|
150
|
+
retry_statuses: retry_statuses,
|
|
151
|
+
retry_methods: retry_methods,
|
|
152
|
+
proxy_settings: proxy_settings
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
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
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
##
|
|
8
|
+
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
|
+
# including optional basic authentication.
|
|
10
|
+
#
|
|
11
|
+
class ProxySettings < CoreLibrary::ProxySettings
|
|
12
|
+
def self.from_env
|
|
13
|
+
address = ENV['PROXY_ADDRESS']
|
|
14
|
+
port = ENV['PROXY_PORT']
|
|
15
|
+
username = ENV['PROXY_USERNAME']
|
|
16
|
+
password = ENV['PROXY_PASSWORD']
|
|
17
|
+
return nil if address.nil? || address.strip.empty?
|
|
18
|
+
|
|
19
|
+
new(address: address, port: port, username: username, password: password)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
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
|
# Base model.
|
|
8
8
|
# rubocop:disable all
|
|
9
9
|
class BaseModel < CoreLibrary::BaseModel
|