wesley-key-sdk 0.1.6 → 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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +67 -25
  3. data/bin/console +4 -4
  4. data/lib/{cypress_test_api → swagger_petstore}/api_helper.rb +2 -2
  5. data/lib/swagger_petstore/client.rb +95 -0
  6. data/lib/{cypress_test_api → swagger_petstore}/configuration.rb +61 -20
  7. data/lib/{cypress_test_api → swagger_petstore}/controllers/base_controller.rb +2 -2
  8. data/lib/swagger_petstore/controllers/pet_controller.rb +206 -0
  9. data/lib/swagger_petstore/controllers/store_controller.rb +94 -0
  10. data/lib/swagger_petstore/controllers/user_controller.rb +165 -0
  11. data/lib/{cypress_test_api → swagger_petstore}/exceptions/api_exception.rb +2 -2
  12. data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +64 -0
  13. data/lib/swagger_petstore/http/auth/api_key.rb +52 -0
  14. data/lib/swagger_petstore/http/auth/http_basic.rb +62 -0
  15. data/lib/swagger_petstore/http/auth/petstore_auth.rb +113 -0
  16. data/lib/{cypress_test_api → swagger_petstore}/http/http_call_back.rb +2 -2
  17. data/lib/{cypress_test_api → swagger_petstore}/http/http_method_enum.rb +2 -2
  18. data/lib/{cypress_test_api → swagger_petstore}/http/http_request.rb +2 -2
  19. data/lib/{cypress_test_api → swagger_petstore}/http/http_response.rb +2 -2
  20. data/lib/{cypress_test_api → swagger_petstore}/http/proxy_settings.rb +2 -2
  21. data/lib/{cypress_test_api/models/message2.rb → swagger_petstore/models/api_response.rb} +24 -14
  22. data/lib/{cypress_test_api → swagger_petstore}/models/base_model.rb +2 -2
  23. data/lib/{cypress_test_api/models/item_response.rb → swagger_petstore/models/category.rb} +10 -19
  24. data/lib/{cypress_test_api/models/deer.rb → swagger_petstore/models/category2.rb} +21 -18
  25. data/lib/swagger_petstore/models/content_type_enum.rb +26 -0
  26. data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +62 -0
  27. data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +36 -0
  28. data/lib/swagger_petstore/models/o_auth_token.rb +96 -0
  29. data/lib/swagger_petstore/models/order.rb +120 -0
  30. data/lib/swagger_petstore/models/pet.rb +117 -0
  31. data/lib/swagger_petstore/models/pet_request.rb +117 -0
  32. data/lib/swagger_petstore/models/status1_enum.rb +40 -0
  33. data/lib/swagger_petstore/models/status2_enum.rb +40 -0
  34. data/lib/{cypress_test_api → swagger_petstore}/models/status_enum.rb +12 -12
  35. data/lib/swagger_petstore/models/store_order_request.rb +120 -0
  36. data/lib/{cypress_test_api/models/response_http404.rb → swagger_petstore/models/tag.rb} +18 -9
  37. data/lib/swagger_petstore/models/user.rb +132 -0
  38. data/lib/swagger_petstore/models/user_request.rb +132 -0
  39. data/lib/{cypress_test_api → swagger_petstore}/utilities/date_time_helper.rb +2 -2
  40. data/lib/{cypress_test_api → swagger_petstore}/utilities/file_wrapper.rb +2 -2
  41. data/lib/swagger_petstore.rb +62 -0
  42. data/test/controllers/controller_test_base.rb +14 -5
  43. data/test/controllers/test_store_controller.rb +31 -0
  44. data/test/http_response_catcher.rb +2 -2
  45. metadata +41 -34
  46. data/lib/cypress_test_api/client.rb +0 -58
  47. data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
  48. data/lib/cypress_test_api/models/custom_enum.rb +0 -40
  49. data/lib/cypress_test_api/models/item.rb +0 -166
  50. data/lib/cypress_test_api/models/lion.rb +0 -68
  51. data/lib/cypress_test_api/models/message.rb +0 -68
  52. data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
  53. data/lib/cypress_test_api/models/nac_tag.rb +0 -265
  54. data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +0 -44
  55. data/lib/cypress_test_api/models/response_http400.rb +0 -62
  56. data/lib/cypress_test_api/models/status11_enum.rb +0 -40
  57. data/lib/cypress_test_api/models/status1_enum.rb +0 -40
  58. data/lib/cypress_test_api/models/tokens_request.rb +0 -60
  59. data/lib/cypress_test_api.rb +0 -55
  60. data/test/controllers/test_api_controller.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8ccc80876b4bddcfbd2f5bba54cb4d9bab55f7de0b0d0b078deabf3e24ff149
4
- data.tar.gz: 9b0b9ebcb2e165727b56be888eaf36481cc75827e12459a03bc828c7466d86e7
3
+ metadata.gz: b32f263fc60a62f3e0f46b9eee4275f72dbcfcb13790f5ba79bad8cfdb1bc660
4
+ data.tar.gz: 2d482091fdb4bf25fa3d6d375775c493b19cca519b5d626cd334359d32d3a9a1
5
5
  SHA512:
6
- metadata.gz: 69b5c83b7d2c862d2db646fac6a28062e91c4f971958236381fa9b200abf37a68f42cf1e2ec5c789ffe980416ff78b9e6f0f70d6bf91721f60ba9124041d3c1b
7
- data.tar.gz: 45d2b0d8c3c4cea9919c2585e094356e3a52015afc72645bc3f581d7661f1d500adb4a60a13839122421a166da56c7de37b3302c149f1ca14a7370e200a6f791
6
+ metadata.gz: d6c6219a7f98f45784f43b1bbb4efe716c219fac7fb3cb4a68e7d3dc4848c95cd254aaf813da791b0e86bd6630a42d75f77619a2a62156defde759452853830d
7
+ data.tar.gz: 8e7eea8e9bafa69b3010ae4899b6ac1c302a8356bbd6ad3c98baaeb548e4f249b5b0730e887e1475030c38efbbbbbea17138726af43cced87bd0274d8cbe5c5e
data/README.md CHANGED
@@ -1,25 +1,27 @@
1
1
 
2
- # Getting Started with Cypress Test API
2
+ # Getting Started with Swagger Petstore
3
3
 
4
4
  ## Introduction
5
5
 
6
- This is a sample API to demonstrate an OpenAPI spec with multiple endpoints and a custom model.
6
+ This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
7
+
8
+ Find out more about Swagger: [http://swagger.io](http://swagger.io)
7
9
 
8
10
  ## Install the Package
9
11
 
10
12
  Install the gem from the command line:
11
13
 
12
14
  ```bash
13
- gem install wesley-key-sdk -v 0.1.6
15
+ gem install wesley-key-sdk -v 0.1.7
14
16
  ```
15
17
 
16
18
  Or add the gem to your Gemfile and run `bundle`:
17
19
 
18
20
  ```ruby
19
- gem 'wesley-key-sdk', '0.1.6'
21
+ gem 'wesley-key-sdk', '0.1.7'
20
22
  ```
21
23
 
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).
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).
23
25
 
24
26
  ## IRB Console Usage
25
27
 
@@ -36,8 +38,8 @@ irb
36
38
  Now you can load the SDK in the IRB
37
39
 
38
40
  ```ruby
39
- require 'cypress_test_api'
40
- include CypressTestApi
41
+ require 'swagger_petstore'
42
+ include SwaggerPetstore
41
43
  ```
42
44
 
43
45
  ### 2. Use IRB within SDK
@@ -45,7 +47,7 @@ include CypressTestApi
45
47
  Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
46
48
 
47
49
  ```
48
- cd path/to/cypress_test_api
50
+ cd path/to/swagger_petstore
49
51
  ```
50
52
 
51
53
  Now you can start the preconfigured irb console by running the following command
@@ -66,13 +68,13 @@ rake
66
68
 
67
69
  ## Initialize the API Client
68
70
 
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)
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)
70
72
 
71
73
  The following parameters are configurable for the API Client:
72
74
 
73
75
  | Parameter | Type | Description |
74
76
  | --- | --- | --- |
75
- | default_host | `String` | *Default*: `'www.example.com'` |
77
+ | test_header | `String` | This is a test header<br>*Default*: `'TestHeaderDefaultValue'` |
76
78
  | environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
77
79
  | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
78
80
  | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
@@ -83,52 +85,92 @@ The following parameters are configurable for the API Client:
83
85
  | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
84
86
  | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
85
87
  | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
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. |
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 |
87
92
 
88
93
  The API client can be initialized as follows:
89
94
 
90
95
  ### Code-Based Client Initialization
91
96
 
92
97
  ```ruby
93
- require 'cypress_test_api'
94
- include CypressTestApi
98
+ require 'swagger_petstore'
99
+ include SwaggerPetstore
95
100
 
96
101
  client = Client.new(
97
- environment: Environment::PRODUCTION,
98
- default_host: 'www.example.com'
102
+ test_header: 'TestHeaderDefaultValue',
103
+ api_key_credentials: ApiKeyCredentials.new(
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
99
119
  )
100
120
  ```
101
121
 
102
122
  ### Environment-Based Client Initialization
103
123
 
104
124
  ```ruby
105
- require 'cypress_test_api'
106
- include CypressTestApi
125
+ require 'swagger_petstore'
126
+ include SwaggerPetstore
107
127
 
108
128
  # Create client from environment
109
129
  client = Client.from_env
110
130
  ```
111
131
 
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.
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
+
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/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)
113
153
 
114
154
  ## List of APIs
115
155
 
116
- * [API](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/0.1.6/doc/controllers/api.md)
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)
117
159
 
118
160
  ## SDK Infrastructure
119
161
 
120
162
  ### Configuration
121
163
 
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)
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)
124
166
 
125
167
  ### HTTP
126
168
 
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)
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)
129
171
 
130
172
  ### Utilities
131
173
 
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)
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)
134
176
 
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 'cypress_test_api'
7
+ require 'swagger_petstore'
8
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'
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
12
 
13
13
  # Start an interactive IRB session
14
14
  require 'irb'
@@ -1,9 +1,9 @@
1
- # cypress_test_api
1
+ # swagger_petstore
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v3.0
4
4
  # ( https://www.apimatic.io ).
5
5
 
6
- module CypressTestApi
6
+ module SwaggerPetstore
7
7
  # API utility class
8
8
  class APIHelper < CoreLibrary::ApiHelper
9
9
  end
@@ -0,0 +1,95 @@
1
+ # swagger_petstore
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module SwaggerPetstore
7
+ # swagger_petstore client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
15
+
16
+ # Returns the configured authentication petstore_auth instance.
17
+ def petstore_auth
18
+ @auth_managers['petstore_auth']
19
+ end
20
+
21
+ # Access to pet controller.
22
+ # @return [PetController] Returns the controller instance.
23
+ def pet
24
+ @pet ||= PetController.new @global_configuration
25
+ end
26
+
27
+ # Access to store controller.
28
+ # @return [StoreController] Returns the controller instance.
29
+ def store
30
+ @store ||= StoreController.new @global_configuration
31
+ end
32
+
33
+ # Access to user controller.
34
+ # @return [UserController] Returns the controller instance.
35
+ def user
36
+ @user ||= UserController.new @global_configuration
37
+ end
38
+
39
+ def initialize(
40
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
41
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
42
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
43
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
44
+ environment: Environment::PRODUCTION, api_key_credentials: nil,
45
+ http_basic_credentials: nil, petstore_auth_credentials: nil,
46
+ test_header: 'TestHeaderDefaultValue', config: nil
47
+ )
48
+ @config = if config.nil?
49
+ Configuration.new(
50
+ connection: connection, adapter: adapter, timeout: timeout,
51
+ max_retries: max_retries, retry_interval: retry_interval,
52
+ backoff_factor: backoff_factor,
53
+ retry_statuses: retry_statuses,
54
+ retry_methods: retry_methods, http_callback: http_callback,
55
+ proxy_settings: proxy_settings, environment: environment,
56
+ api_key_credentials: api_key_credentials,
57
+ http_basic_credentials: http_basic_credentials,
58
+ petstore_auth_credentials: petstore_auth_credentials,
59
+ test_header: test_header
60
+ )
61
+ else
62
+ config
63
+ end
64
+
65
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
66
+ .base_uri_executor(@config.method(:get_base_uri))
67
+ .global_errors(BaseController::GLOBAL_ERRORS)
68
+ .user_agent(BaseController.user_agent)
69
+ .global_header('TestHeader', @config.test_header)
70
+
71
+ initialize_auth_managers(@global_configuration)
72
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
73
+ end
74
+
75
+ # Initializes the auth managers hash used for authenticating API calls.
76
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
77
+ def initialize_auth_managers(global_config)
78
+ @auth_managers = {}
79
+ http_client_config = global_config.client_configuration
80
+ %w[api_key httpBasic petstore_auth].each { |auth| @auth_managers[auth] = nil }
81
+ @auth_managers['api_key'] = ApiKey.new(http_client_config.api_key_credentials)
82
+ @auth_managers['httpBasic'] = HttpBasic.new(http_client_config.http_basic_credentials)
83
+ @auth_managers['petstore_auth'] = PetstoreAuth.new(
84
+ http_client_config.petstore_auth_credentials, global_config
85
+ )
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
94
+ end
95
+ end
@@ -1,20 +1,31 @@
1
- # cypress_test_api
1
+ # swagger_petstore
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v3.0
4
4
  # ( https://www.apimatic.io ).
5
5
 
6
- module CypressTestApi
6
+ module SwaggerPetstore
7
7
  # An enum for SDK environments.
8
8
  class Environment
9
9
  ENVIRONMENT = [
10
- PRODUCTION = 'production'.freeze
10
+ PRODUCTION = 'production'.freeze,
11
+ ENVIRONMENT2 = 'environment2'.freeze,
12
+ ENVIRONMENT3 = 'environment3'.freeze
11
13
  ].freeze
12
14
 
13
15
  # Converts a string or symbol into a valid Environment constant.
14
16
  def self.from_value(value, default_value = PRODUCTION)
15
17
  return default_value if value.nil?
16
18
 
17
- default_value
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
18
29
  end
19
30
  end
20
31
 
@@ -36,7 +47,8 @@ module CypressTestApi
36
47
  # are configured in this class.
37
48
  class Configuration < CoreLibrary::HttpClientConfiguration
38
49
  # The attribute readers for properties.
39
- attr_reader :environment, :default_host
50
+ attr_reader :environment, :api_key_credentials, :http_basic_credentials,
51
+ :petstore_auth_credentials, :test_header
40
52
 
41
53
  class << self
42
54
  attr_reader :environments
@@ -47,7 +59,9 @@ module CypressTestApi
47
59
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
48
60
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
49
61
  retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
50
- environment: Environment::PRODUCTION, default_host: 'www.example.com'
62
+ environment: Environment::PRODUCTION, api_key_credentials: nil,
63
+ http_basic_credentials: nil, petstore_auth_credentials: nil,
64
+ test_header: 'TestHeaderDefaultValue'
51
65
  )
52
66
  super connection: connection, adapter: adapter, timeout: timeout,
53
67
  max_retries: max_retries, retry_interval: retry_interval,
@@ -58,8 +72,17 @@ module CypressTestApi
58
72
  # Current API environment
59
73
  @environment = String(environment)
60
74
 
61
- # defaultHost value
62
- @default_host = default_host
75
+ # The object holding Custom Header Signature credentials
76
+ @api_key_credentials = api_key_credentials
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
63
86
 
64
87
  # The Http Client to use for making requests.
65
88
  set_http_client CoreLibrary::FaradayClient.new(self)
@@ -68,7 +91,9 @@ module CypressTestApi
68
91
  def clone_with(connection: nil, adapter: nil, timeout: nil,
69
92
  max_retries: nil, retry_interval: nil, backoff_factor: nil,
70
93
  retry_statuses: nil, retry_methods: nil, http_callback: nil,
71
- proxy_settings: nil, environment: nil, default_host: nil)
94
+ proxy_settings: nil, environment: nil,
95
+ api_key_credentials: nil, http_basic_credentials: nil,
96
+ petstore_auth_credentials: nil, test_header: nil)
72
97
  connection ||= self.connection
73
98
  adapter ||= self.adapter
74
99
  timeout ||= self.timeout
@@ -80,7 +105,10 @@ module CypressTestApi
80
105
  http_callback ||= self.http_callback
81
106
  proxy_settings ||= self.proxy_settings
82
107
  environment ||= self.environment
83
- default_host ||= self.default_host
108
+ api_key_credentials ||= self.api_key_credentials
109
+ http_basic_credentials ||= self.http_basic_credentials
110
+ petstore_auth_credentials ||= self.petstore_auth_credentials
111
+ test_header ||= self.test_header
84
112
 
85
113
  Configuration.new(connection: connection, adapter: adapter,
86
114
  timeout: timeout, max_retries: max_retries,
@@ -90,14 +118,24 @@ module CypressTestApi
90
118
  retry_methods: retry_methods,
91
119
  http_callback: http_callback,
92
120
  proxy_settings: proxy_settings,
93
- environment: environment, default_host: default_host)
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)
94
126
  end
95
127
 
96
128
 
97
129
  # All the environments the SDK can run in.
98
130
  ENVIRONMENTS = {
99
131
  Environment::PRODUCTION => {
100
- Server::DEFAULT => 'https://{defaultHost}'
132
+ Server::DEFAULT => 'https://petstore.swagger.io/v2'
133
+ },
134
+ Environment::ENVIRONMENT2 => {
135
+ Server::DEFAULT => 'http://petstore.swagger.io/v2'
136
+ },
137
+ Environment::ENVIRONMENT3 => {
138
+ Server::DEFAULT => 'https://petstore.swagger.io/oauth'
101
139
  }
102
140
  }.freeze
103
141
 
@@ -106,19 +144,14 @@ module CypressTestApi
106
144
  # required.
107
145
  # @return [String] The base URI.
108
146
  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
- )
147
+ ENVIRONMENTS[environment][server].clone
115
148
  end
116
149
 
117
150
  # Builds a Configuration instance using environment variables.
118
151
  def self.build_default_config_from_env
119
152
  # === Core environment ===
120
153
  environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
121
- default_host = ENV.fetch('DEFAULT_HOST', 'www.example.com')
154
+ test_header = ENV.fetch('TEST_HEADER', 'TestHeaderDefaultValue')
122
155
  timeout = (ENV['TIMEOUT'] || 60).to_f
123
156
  max_retries = (ENV['MAX_RETRIES'] || 0).to_i
124
157
  retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
@@ -137,18 +170,26 @@ module CypressTestApi
137
170
  item.match?(/\A\d+\z/) ? item.to_i : item.downcase
138
171
  end
139
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
+
140
178
  # === Proxy settings ===
141
179
  proxy_settings = ProxySettings.from_env
142
180
 
143
181
  Configuration.new(
144
182
  environment: environment,
145
- default_host: default_host,
183
+ test_header: test_header,
146
184
  timeout: timeout,
147
185
  max_retries: max_retries,
148
186
  retry_interval: retry_interval,
149
187
  backoff_factor: backoff_factor,
150
188
  retry_statuses: retry_statuses,
151
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,
152
193
  proxy_settings: proxy_settings
153
194
  )
154
195
  end
@@ -1,9 +1,9 @@
1
- # cypress_test_api
1
+ # swagger_petstore
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v3.0
4
4
  # ( https://www.apimatic.io ).
5
5
 
6
- module CypressTestApi
6
+ module SwaggerPetstore
7
7
  # BaseController.
8
8
  class BaseController
9
9
  include CoreLibrary