wesley-key-sdk 0.1.3 → 0.1.7
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 +69 -19
- data/bin/console +15 -0
- data/lib/swagger_petstore/client.rb +11 -0
- data/lib/swagger_petstore/configuration.rb +70 -0
- data/lib/swagger_petstore/http/auth/api_key.rb +10 -0
- data/lib/swagger_petstore/http/auth/http_basic.rb +12 -0
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +15 -0
- data/lib/swagger_petstore/http/proxy_settings.rb +9 -0
- data/lib/swagger_petstore/models/content_type_enum.rb +6 -0
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +17 -0
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +13 -0
- data/lib/swagger_petstore/models/status1_enum.rb +14 -0
- data/lib/swagger_petstore/models/status2_enum.rb +14 -0
- data/lib/swagger_petstore/models/status_enum.rb +14 -0
- data/lib/swagger_petstore.rb +8 -8
- data/test/controllers/controller_test_base.rb +4 -9
- data/test/controllers/test_store_controller.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b32f263fc60a62f3e0f46b9eee4275f72dbcfcb13790f5ba79bad8cfdb1bc660
|
|
4
|
+
data.tar.gz: 2d482091fdb4bf25fa3d6d375775c493b19cca519b5d626cd334359d32d3a9a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6c6219a7f98f45784f43b1bbb4efe716c219fac7fb3cb4a68e7d3dc4848c95cd254aaf813da791b0e86bd6630a42d75f77619a2a62156defde759452853830d
|
|
7
|
+
data.tar.gz: 8e7eea8e9bafa69b3010ae4899b6ac1c302a8356bbd6ad3c98baaeb548e4f249b5b0730e887e1475030c38efbbbbbea17138726af43cced87bd0274d8cbe5c5e
|
data/README.md
CHANGED
|
@@ -12,16 +12,51 @@ Find out more about Swagger: [http://swagger.io](http://swagger.io)
|
|
|
12
12
|
Install the gem from the command line:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
gem install wesley-key-sdk -v 0.1.
|
|
15
|
+
gem install wesley-key-sdk -v 0.1.7
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Or add the gem to your Gemfile and run `bundle`:
|
|
19
19
|
|
|
20
20
|
```ruby
|
|
21
|
-
gem 'wesley-key-sdk', '0.1.
|
|
21
|
+
gem 'wesley-key-sdk', '0.1.7'
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/0.1.
|
|
24
|
+
For additional gem details, see the [RubyGems page for the wesley-key-sdk gem](https://rubygems.org/gems/wesley-key-sdk/versions/0.1.7).
|
|
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'
|
|
42
|
+
include SwaggerPetstore
|
|
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
|
|
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/
|
|
25
60
|
|
|
26
61
|
## Test the SDK
|
|
27
62
|
|
|
@@ -33,7 +68,7 @@ rake
|
|
|
33
68
|
|
|
34
69
|
## Initialize the API Client
|
|
35
70
|
|
|
36
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
71
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/client.md)
|
|
37
72
|
|
|
38
73
|
The following parameters are configurable for the API Client:
|
|
39
74
|
|
|
@@ -50,13 +85,15 @@ The following parameters are configurable for the API Client:
|
|
|
50
85
|
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
51
86
|
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
52
87
|
| 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.
|
|
55
|
-
| http_basic_credentials | [`HttpBasicCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
56
|
-
| petstore_auth_credentials | [`PetstoreAuthCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
88
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
89
|
+
| api_key_credentials | [`ApiKeyCredentials`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/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/0.1.7/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/0.1.7/doc/auth/oauth-2-implicit-grant.md) | The credential object for OAuth 2 Implicit Grant |
|
|
57
92
|
|
|
58
93
|
The API client can be initialized as follows:
|
|
59
94
|
|
|
95
|
+
### Code-Based Client Initialization
|
|
96
|
+
|
|
60
97
|
```ruby
|
|
61
98
|
require 'swagger_petstore'
|
|
62
99
|
include SwaggerPetstore
|
|
@@ -82,6 +119,18 @@ client = Client.new(
|
|
|
82
119
|
)
|
|
83
120
|
```
|
|
84
121
|
|
|
122
|
+
### Environment-Based Client Initialization
|
|
123
|
+
|
|
124
|
+
```ruby
|
|
125
|
+
require 'swagger_petstore'
|
|
126
|
+
include SwaggerPetstore
|
|
127
|
+
|
|
128
|
+
# Create client from environment
|
|
129
|
+
client = Client.from_env
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/environment-based-client-initialization.md) section for details.
|
|
133
|
+
|
|
85
134
|
## Environments
|
|
86
135
|
|
|
87
136
|
The SDK can be configured to use a different environment for making API calls. Available environments are:
|
|
@@ -98,29 +147,30 @@ The SDK can be configured to use a different environment for making API calls. A
|
|
|
98
147
|
|
|
99
148
|
This API uses the following authentication schemes.
|
|
100
149
|
|
|
101
|
-
* [`api_key (Custom Header Signature)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
102
|
-
* [`httpBasic (Basic Authentication)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
103
|
-
* [`petstore_auth (OAuth 2 Implicit Grant)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
150
|
+
* [`api_key (Custom Header Signature)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/auth/custom-header-signature.md)
|
|
151
|
+
* [`httpBasic (Basic Authentication)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/auth/basic-authentication.md)
|
|
152
|
+
* [`petstore_auth (OAuth 2 Implicit Grant)`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/auth/oauth-2-implicit-grant.md)
|
|
104
153
|
|
|
105
154
|
## List of APIs
|
|
106
155
|
|
|
107
|
-
* [Pet](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
108
|
-
* [Store](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
109
|
-
* [User](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
156
|
+
* [Pet](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/controllers/pet.md)
|
|
157
|
+
* [Store](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/controllers/store.md)
|
|
158
|
+
* [User](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/controllers/user.md)
|
|
110
159
|
|
|
111
160
|
## SDK Infrastructure
|
|
112
161
|
|
|
113
162
|
### Configuration
|
|
114
163
|
|
|
115
|
-
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.
|
|
164
|
+
* [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/proxy-settings.md)
|
|
165
|
+
* [Environment-Based Client Initialization](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/environment-based-client-initialization.md)
|
|
116
166
|
|
|
117
167
|
### HTTP
|
|
118
168
|
|
|
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.
|
|
169
|
+
* [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/http-response.md)
|
|
170
|
+
* [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/http-request.md)
|
|
121
171
|
|
|
122
172
|
### Utilities
|
|
123
173
|
|
|
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.
|
|
174
|
+
* [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/api-helper.md)
|
|
175
|
+
* [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.7/doc/date-time-helper.md)
|
|
126
176
|
|
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'
|
|
8
|
+
|
|
9
|
+
puts 'SwaggerPetstore SDK loaded!'
|
|
10
|
+
puts 'You can now create a client with: client = SwaggerPetstore::Client.new'
|
|
11
|
+
puts 'Or use from_env: client = SwaggerPetstore::Client.from_env'
|
|
12
|
+
|
|
13
|
+
# Start an interactive IRB session
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start
|
|
@@ -8,6 +8,10 @@ module SwaggerPetstore
|
|
|
8
8
|
class Client
|
|
9
9
|
include CoreLibrary
|
|
10
10
|
attr_reader :config, :auth_managers
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
11
15
|
|
|
12
16
|
# Returns the configured authentication petstore_auth instance.
|
|
13
17
|
def petstore_auth
|
|
@@ -80,5 +84,12 @@ module SwaggerPetstore
|
|
|
80
84
|
http_client_config.petstore_auth_credentials, global_config
|
|
81
85
|
)
|
|
82
86
|
end
|
|
87
|
+
|
|
88
|
+
# Creates a client directly from environment variables.
|
|
89
|
+
def self.from_env(**overrides)
|
|
90
|
+
default_config = Configuration.build_default_config_from_env
|
|
91
|
+
new_config = default_config.clone_with(**overrides)
|
|
92
|
+
new(config: new_config)
|
|
93
|
+
end
|
|
83
94
|
end
|
|
84
95
|
end
|
|
@@ -11,6 +11,22 @@ module SwaggerPetstore
|
|
|
11
11
|
ENVIRONMENT2 = 'environment2'.freeze,
|
|
12
12
|
ENVIRONMENT3 = 'environment3'.freeze
|
|
13
13
|
].freeze
|
|
14
|
+
|
|
15
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
16
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
17
|
+
return default_value if value.nil?
|
|
18
|
+
|
|
19
|
+
str = value.to_s.strip.downcase
|
|
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
|
|
29
|
+
end
|
|
14
30
|
end
|
|
15
31
|
|
|
16
32
|
# An enum for API servers.
|
|
@@ -18,6 +34,13 @@ module SwaggerPetstore
|
|
|
18
34
|
SERVER = [
|
|
19
35
|
DEFAULT = 'default'.freeze
|
|
20
36
|
].freeze
|
|
37
|
+
|
|
38
|
+
# Converts a string or symbol into a valid Server constant.
|
|
39
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
40
|
+
return default_value if value.nil?
|
|
41
|
+
|
|
42
|
+
default_value
|
|
43
|
+
end
|
|
21
44
|
end
|
|
22
45
|
|
|
23
46
|
# All configuration including auth info and base URI for the API access
|
|
@@ -123,5 +146,52 @@ module SwaggerPetstore
|
|
|
123
146
|
def get_base_uri(server = Server::DEFAULT)
|
|
124
147
|
ENVIRONMENTS[environment][server].clone
|
|
125
148
|
end
|
|
149
|
+
|
|
150
|
+
# Builds a Configuration instance using environment variables.
|
|
151
|
+
def self.build_default_config_from_env
|
|
152
|
+
# === Core environment ===
|
|
153
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
154
|
+
test_header = ENV.fetch('TEST_HEADER', 'TestHeaderDefaultValue')
|
|
155
|
+
timeout = (ENV['TIMEOUT'] || 60).to_f
|
|
156
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
157
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
158
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
159
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
160
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
161
|
+
.split(',')
|
|
162
|
+
.map(&:strip)
|
|
163
|
+
.map do |item|
|
|
164
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
165
|
+
end
|
|
166
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
|
|
167
|
+
.split(',')
|
|
168
|
+
.map(&:strip)
|
|
169
|
+
.map do |item|
|
|
170
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
171
|
+
end
|
|
172
|
+
|
|
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
|
+
# === Proxy settings ===
|
|
179
|
+
proxy_settings = ProxySettings.from_env
|
|
180
|
+
|
|
181
|
+
Configuration.new(
|
|
182
|
+
environment: environment,
|
|
183
|
+
test_header: test_header,
|
|
184
|
+
timeout: timeout,
|
|
185
|
+
max_retries: max_retries,
|
|
186
|
+
retry_interval: retry_interval,
|
|
187
|
+
backoff_factor: backoff_factor,
|
|
188
|
+
retry_statuses: retry_statuses,
|
|
189
|
+
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
|
+
proxy_settings: proxy_settings
|
|
194
|
+
)
|
|
195
|
+
end
|
|
126
196
|
end
|
|
127
197
|
end
|
|
@@ -33,6 +33,16 @@ module SwaggerPetstore
|
|
|
33
33
|
@api_key = api_key
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def self.from_env
|
|
37
|
+
api_key = ENV['API_KEY_API_KEY']
|
|
38
|
+
all_nil = [
|
|
39
|
+
api_key
|
|
40
|
+
].all?(&:nil?)
|
|
41
|
+
return nil if all_nil
|
|
42
|
+
|
|
43
|
+
new(api_key: api_key)
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
def clone_with(api_key: nil)
|
|
37
47
|
api_key ||= self.api_key
|
|
38
48
|
|
|
@@ -40,6 +40,18 @@ module SwaggerPetstore
|
|
|
40
40
|
@passwprd = passwprd
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def self.from_env
|
|
44
|
+
username = ENV['HTTP_BASIC_USERNAME']
|
|
45
|
+
passwprd = ENV['HTTP_BASIC_PASSWPRD']
|
|
46
|
+
all_nil = [
|
|
47
|
+
username,
|
|
48
|
+
passwprd
|
|
49
|
+
].all?(&:nil?)
|
|
50
|
+
return nil if all_nil
|
|
51
|
+
|
|
52
|
+
new(username: username, passwprd: passwprd)
|
|
53
|
+
end
|
|
54
|
+
|
|
43
55
|
def clone_with(username: nil, passwprd: nil)
|
|
44
56
|
username ||= self.username
|
|
45
57
|
passwprd ||= self.passwprd
|
|
@@ -82,6 +82,21 @@ module SwaggerPetstore
|
|
|
82
82
|
@o_auth_scopes = o_auth_scopes
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
def self.from_env
|
|
86
|
+
o_auth_client_id = ENV['PETSTORE_AUTH_O_AUTH_CLIENT_ID']
|
|
87
|
+
o_auth_redirect_uri = ENV['PETSTORE_AUTH_O_AUTH_REDIRECT_URI']
|
|
88
|
+
o_auth_scopes = ENV['PETSTORE_AUTH_O_AUTH_SCOPES']
|
|
89
|
+
all_nil = [
|
|
90
|
+
o_auth_client_id,
|
|
91
|
+
o_auth_redirect_uri
|
|
92
|
+
].all?(&:nil?)
|
|
93
|
+
return nil if all_nil
|
|
94
|
+
|
|
95
|
+
new(o_auth_client_id: o_auth_client_id,
|
|
96
|
+
o_auth_redirect_uri: o_auth_redirect_uri,
|
|
97
|
+
o_auth_scopes: o_auth_scopes)
|
|
98
|
+
end
|
|
99
|
+
|
|
85
100
|
def clone_with(o_auth_client_id: nil, o_auth_redirect_uri: nil,
|
|
86
101
|
o_auth_token: nil, o_auth_scopes: nil)
|
|
87
102
|
o_auth_client_id ||= self.o_auth_client_id
|
|
@@ -9,5 +9,14 @@ module SwaggerPetstore
|
|
|
9
9
|
# including optional basic authentication.
|
|
10
10
|
#
|
|
11
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
|
|
12
21
|
end
|
|
13
22
|
end
|
|
@@ -41,5 +41,22 @@ module SwaggerPetstore
|
|
|
41
41
|
|
|
42
42
|
O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
def self.from_value(value, default_value = INVALID_REQUEST)
|
|
46
|
+
return default_value if value.nil?
|
|
47
|
+
|
|
48
|
+
str = value.to_s.strip
|
|
49
|
+
|
|
50
|
+
case str.downcase
|
|
51
|
+
when 'invalid_request' then INVALID_REQUEST
|
|
52
|
+
when 'invalid_client' then INVALID_CLIENT
|
|
53
|
+
when 'invalid_grant' then INVALID_GRANT
|
|
54
|
+
when 'unauthorized_client' then UNAUTHORIZED_CLIENT
|
|
55
|
+
when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
|
|
56
|
+
when 'invalid_scope' then INVALID_SCOPE
|
|
57
|
+
else
|
|
58
|
+
default_value
|
|
59
|
+
end
|
|
60
|
+
end
|
|
44
61
|
end
|
|
45
62
|
end
|
|
@@ -19,5 +19,18 @@ module SwaggerPetstore
|
|
|
19
19
|
|
|
20
20
|
O_AUTH_SCOPE_PETSTORE_AUTH_ENUM.include?(value)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = READPETS)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'readpets' then READPETS
|
|
30
|
+
when 'writepets' then WRITEPETS
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
22
35
|
end
|
|
23
36
|
end
|
|
@@ -22,5 +22,19 @@ module SwaggerPetstore
|
|
|
22
22
|
|
|
23
23
|
STATUS1_ENUM.include?(value)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = PLACED)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'placed' then PLACED
|
|
33
|
+
when 'approved' then APPROVED
|
|
34
|
+
when 'delivered' then DELIVERED
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
25
39
|
end
|
|
26
40
|
end
|
|
@@ -22,5 +22,19 @@ module SwaggerPetstore
|
|
|
22
22
|
|
|
23
23
|
STATUS2_ENUM.include?(value)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = AVAILABLE)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'available' then AVAILABLE
|
|
33
|
+
when 'pending' then PENDING
|
|
34
|
+
when 'sold' then SOLD
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
25
39
|
end
|
|
26
40
|
end
|
|
@@ -22,5 +22,19 @@ module SwaggerPetstore
|
|
|
22
22
|
|
|
23
23
|
STATUS_ENUM.include?(value)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = AVAILABLE)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'available' then AVAILABLE
|
|
33
|
+
when 'pending' then PENDING
|
|
34
|
+
when 'sold' then SOLD
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
25
39
|
end
|
|
26
40
|
end
|
data/lib/swagger_petstore.rb
CHANGED
|
@@ -31,21 +31,21 @@ require_relative 'swagger_petstore/http/auth/petstore_auth'
|
|
|
31
31
|
|
|
32
32
|
# Models
|
|
33
33
|
require_relative 'swagger_petstore/models/base_model'
|
|
34
|
-
require_relative 'swagger_petstore/models/
|
|
34
|
+
require_relative 'swagger_petstore/models/pet'
|
|
35
|
+
require_relative 'swagger_petstore/models/tag'
|
|
36
|
+
require_relative 'swagger_petstore/models/user'
|
|
37
|
+
require_relative 'swagger_petstore/models/api_response'
|
|
35
38
|
require_relative 'swagger_petstore/models/category'
|
|
36
39
|
require_relative 'swagger_petstore/models/order'
|
|
40
|
+
require_relative 'swagger_petstore/models/category2'
|
|
37
41
|
require_relative 'swagger_petstore/models/pet_request'
|
|
38
|
-
require_relative 'swagger_petstore/models/tag'
|
|
39
42
|
require_relative 'swagger_petstore/models/store_order_request'
|
|
40
|
-
require_relative 'swagger_petstore/models/
|
|
41
|
-
require_relative 'swagger_petstore/models/api_response'
|
|
42
|
-
require_relative 'swagger_petstore/models/user'
|
|
43
|
-
require_relative 'swagger_petstore/models/category2'
|
|
43
|
+
require_relative 'swagger_petstore/models/user_request'
|
|
44
44
|
require_relative 'swagger_petstore/models/o_auth_token'
|
|
45
|
-
require_relative 'swagger_petstore/models/content_type_enum'
|
|
46
45
|
require_relative 'swagger_petstore/models/status1_enum'
|
|
47
|
-
require_relative 'swagger_petstore/models/status_enum'
|
|
48
46
|
require_relative 'swagger_petstore/models/status2_enum'
|
|
47
|
+
require_relative 'swagger_petstore/models/status_enum'
|
|
48
|
+
require_relative 'swagger_petstore/models/content_type_enum'
|
|
49
49
|
require_relative 'swagger_petstore/models/o_auth_provider_error_enum'
|
|
50
50
|
require_relative 'swagger_petstore/models/o_auth_scope_petstore_auth_enum'
|
|
51
51
|
|
|
@@ -16,20 +16,15 @@ class ControllerTestBase < Minitest::Test
|
|
|
16
16
|
include SwaggerPetstore
|
|
17
17
|
include CoreLibrary
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
def
|
|
21
|
-
|
|
19
|
+
# Initializes the base test controller
|
|
20
|
+
def setup_class
|
|
21
|
+
@client = Client.from_env(
|
|
22
22
|
http_basic_credentials: HttpBasicCredentials.new(username: 'test',
|
|
23
23
|
passwprd: 'testPassword'),
|
|
24
24
|
http_callback: HttpResponseCatcher.new
|
|
25
25
|
)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Initializes the base test controller
|
|
29
|
-
def setup_class
|
|
30
|
-
_config = create_configuration
|
|
31
|
-
@client = Client.new(config: _config)
|
|
32
26
|
|
|
27
|
+
_config = @client.config
|
|
33
28
|
petstore_auth_token = @client.petstore_auth.fetch_token()
|
|
34
29
|
petstore_auth_credentials = _config.petstore_auth_credentials.clone_with(o_auth_token: petstore_auth_token)
|
|
35
30
|
_config = _config.clone_with(petstore_auth_credentials: petstore_auth_credentials)
|
|
@@ -23,7 +23,7 @@ class StoreControllerTest < ControllerTestBase
|
|
|
23
23
|
assert_equal(200, @response_catcher.response.status_code)
|
|
24
24
|
# Test headers
|
|
25
25
|
expected_headers = {}
|
|
26
|
-
expected_headers['content-type'] = 'application/json'
|
|
26
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
27
27
|
|
|
28
28
|
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wesley-key-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kenyon Jacobs
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: apimatic_core_interfaces
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.2.
|
|
19
|
+
version: 0.2.3
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.2.
|
|
26
|
+
version: 0.2.3
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: apimatic_core
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.3.
|
|
33
|
+
version: 0.3.20
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.3.
|
|
40
|
+
version: 0.3.20
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: apimatic_faraday_client_adapter
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- LICENSE
|
|
91
91
|
- README.md
|
|
92
|
+
- bin/console
|
|
92
93
|
- lib/swagger_petstore.rb
|
|
93
94
|
- lib/swagger_petstore/api_helper.rb
|
|
94
95
|
- lib/swagger_petstore/client.rb
|