wesley-key-sdk 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +84 -0
  4. data/lib/cypress_test_api/api_helper.rb +10 -0
  5. data/lib/cypress_test_api/client.rb +47 -0
  6. data/lib/cypress_test_api/configuration.rb +103 -0
  7. data/lib/cypress_test_api/controllers/api_controller.rb +102 -0
  8. data/lib/cypress_test_api/controllers/base_controller.rb +60 -0
  9. data/lib/cypress_test_api/exceptions/api_exception.rb +21 -0
  10. data/lib/cypress_test_api/http/http_call_back.rb +10 -0
  11. data/lib/cypress_test_api/http/http_method_enum.rb +10 -0
  12. data/lib/cypress_test_api/http/http_request.rb +10 -0
  13. data/lib/cypress_test_api/http/http_response.rb +10 -0
  14. data/lib/cypress_test_api/http/proxy_settings.rb +13 -0
  15. data/lib/cypress_test_api/models/base_model.rb +110 -0
  16. data/lib/cypress_test_api/models/custom_enum.rb +26 -0
  17. data/lib/cypress_test_api/models/deer.rb +68 -0
  18. data/lib/cypress_test_api/models/item.rb +166 -0
  19. data/lib/cypress_test_api/models/item_response.rb +80 -0
  20. data/lib/cypress_test_api/models/lion.rb +68 -0
  21. data/lib/cypress_test_api/models/message.rb +68 -0
  22. data/lib/cypress_test_api/models/message2.rb +71 -0
  23. data/lib/cypress_test_api/models/multiple_arrays_request.rb +70 -0
  24. data/lib/cypress_test_api/models/nac_tag.rb +265 -0
  25. data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +29 -0
  26. data/lib/cypress_test_api/models/response_http400.rb +62 -0
  27. data/lib/cypress_test_api/models/response_http404.rb +62 -0
  28. data/lib/cypress_test_api/models/status11_enum.rb +26 -0
  29. data/lib/cypress_test_api/models/status1_enum.rb +26 -0
  30. data/lib/cypress_test_api/models/status_enum.rb +26 -0
  31. data/lib/cypress_test_api/models/tokens_request.rb +60 -0
  32. data/lib/cypress_test_api/utilities/date_time_helper.rb +11 -0
  33. data/lib/cypress_test_api/utilities/file_wrapper.rb +28 -0
  34. data/lib/cypress_test_api.rb +55 -0
  35. data/test/controllers/controller_test_base.rb +29 -0
  36. data/test/controllers/test_api_controller.rb +40 -0
  37. data/test/http_response_catcher.rb +19 -0
  38. metadata +149 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 987a43498857664572a8228264bc2b63580e6120df139eb5087bbc800d9fa469
4
+ data.tar.gz: 68ea1ecd67713a031a8f71d67542aa076efe3754c26b1960b2de8f61ccda73f1
5
+ SHA512:
6
+ metadata.gz: 8713b6f446cc6593942de3d498ab6696700324137cfe784f9fd8526cb6e0cdf17354c21d353bf7b54ce61f0282508ef75f11e458d6ad36000bb262caec367842
7
+ data.tar.gz: ca0e97d5a2dfaf407b8b44d040889723212ff67260575075290f90b8a1ac3e94b2132b9aaf3683045fc50479dc145396f896e56501204e90c05a5f1167043fdf
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2025 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+
2
+ # Getting Started with Cypress Test API
3
+
4
+ ## Introduction
5
+
6
+ This is a sample API to demonstrate an OpenAPI spec with multiple endpoints and a custom model.
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```bash
13
+ gem install wesley-key-sdk -v 1.1.1
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'wesley-key-sdk', '1.1.1'
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/1.1.1).
23
+
24
+ ## Test the SDK
25
+
26
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
27
+
28
+ ```
29
+ rake
30
+ ```
31
+
32
+ ## Initialize the API Client
33
+
34
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/client.md)
35
+
36
+ The following parameters are configurable for the API Client:
37
+
38
+ | Parameter | Type | Description |
39
+ | --- | --- | --- |
40
+ | default_host | `String` | *Default*: `'www.example.com'` |
41
+ | environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
42
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
43
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
44
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
45
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
46
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
47
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
48
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
49
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
50
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
51
+ | proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
52
+
53
+ The API client can be initialized as follows:
54
+
55
+ ```ruby
56
+ require 'cypress_test_api'
57
+ include CypressTestApi
58
+
59
+ client = Client.new(
60
+ environment: Environment::PRODUCTION,
61
+ default_host: 'www.example.com'
62
+ )
63
+ ```
64
+
65
+ ## List of APIs
66
+
67
+ * [API](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/controllers/api.md)
68
+
69
+ ## SDK Infrastructure
70
+
71
+ ### Configuration
72
+
73
+ * [ProxySettings](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/proxy-settings.md)
74
+
75
+ ### HTTP
76
+
77
+ * [HttpResponse](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/http-response.md)
78
+ * [HttpRequest](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/http-request.md)
79
+
80
+ ### Utilities
81
+
82
+ * [ApiHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/api-helper.md)
83
+ * [DateTimeHelper](https://www.github.com/ZahraN444/wesley-key-ruby-sdk/tree/1.1.1/doc/date-time-helper.md)
84
+
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,47 @@
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
+ # Access to client controller.
13
+ # @return [APIController] Returns the controller instance.
14
+ def client
15
+ @client ||= APIController.new @global_configuration
16
+ end
17
+
18
+ def initialize(
19
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
20
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
21
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
22
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
23
+ environment: Environment::PRODUCTION, default_host: 'www.example.com',
24
+ config: nil
25
+ )
26
+ @config = if config.nil?
27
+ Configuration.new(connection: connection, adapter: adapter,
28
+ timeout: timeout, max_retries: max_retries,
29
+ retry_interval: retry_interval,
30
+ backoff_factor: backoff_factor,
31
+ retry_statuses: retry_statuses,
32
+ retry_methods: retry_methods,
33
+ http_callback: http_callback,
34
+ proxy_settings: proxy_settings,
35
+ environment: environment,
36
+ default_host: default_host)
37
+ else
38
+ config
39
+ end
40
+
41
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
42
+ .base_uri_executor(@config.method(:get_base_uri))
43
+ .global_errors(BaseController::GLOBAL_ERRORS)
44
+ .user_agent(BaseController.user_agent)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,103 @@
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
+ end
13
+
14
+ # An enum for API servers.
15
+ class Server
16
+ SERVER = [
17
+ DEFAULT = 'default'.freeze
18
+ ].freeze
19
+ end
20
+
21
+ # All configuration including auth info and base URI for the API access
22
+ # are configured in this class.
23
+ class Configuration < CoreLibrary::HttpClientConfiguration
24
+ # The attribute readers for properties.
25
+ attr_reader :environment, :default_host
26
+
27
+ class << self
28
+ attr_reader :environments
29
+ end
30
+
31
+ def initialize(
32
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
33
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
34
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
35
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
36
+ environment: Environment::PRODUCTION, default_host: 'www.example.com'
37
+ )
38
+ super connection: connection, adapter: adapter, timeout: timeout,
39
+ max_retries: max_retries, retry_interval: retry_interval,
40
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
41
+ retry_methods: retry_methods, http_callback: http_callback,
42
+ proxy_settings: proxy_settings
43
+
44
+ # Current API environment
45
+ @environment = String(environment)
46
+
47
+ # defaultHost value
48
+ @default_host = default_host
49
+
50
+ # The Http Client to use for making requests.
51
+ set_http_client CoreLibrary::FaradayClient.new(self)
52
+ end
53
+
54
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
55
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
56
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
57
+ proxy_settings: nil, environment: nil, default_host: nil)
58
+ connection ||= self.connection
59
+ adapter ||= self.adapter
60
+ timeout ||= self.timeout
61
+ max_retries ||= self.max_retries
62
+ retry_interval ||= self.retry_interval
63
+ backoff_factor ||= self.backoff_factor
64
+ retry_statuses ||= self.retry_statuses
65
+ retry_methods ||= self.retry_methods
66
+ http_callback ||= self.http_callback
67
+ proxy_settings ||= self.proxy_settings
68
+ environment ||= self.environment
69
+ default_host ||= self.default_host
70
+
71
+ Configuration.new(connection: connection, adapter: adapter,
72
+ timeout: timeout, max_retries: max_retries,
73
+ retry_interval: retry_interval,
74
+ backoff_factor: backoff_factor,
75
+ retry_statuses: retry_statuses,
76
+ retry_methods: retry_methods,
77
+ http_callback: http_callback,
78
+ proxy_settings: proxy_settings,
79
+ environment: environment, default_host: default_host)
80
+ end
81
+
82
+
83
+ # All the environments the SDK can run in.
84
+ ENVIRONMENTS = {
85
+ Environment::PRODUCTION => {
86
+ Server::DEFAULT => 'https://{defaultHost}'
87
+ }
88
+ }.freeze
89
+
90
+ # Generates the appropriate base URI for the environment and the server.
91
+ # @param [Configuration::Server] server The server enum for which the base URI is
92
+ # required.
93
+ # @return [String] The base URI.
94
+ def get_base_uri(server = Server::DEFAULT)
95
+ parameters = {
96
+ 'defaultHost' => { 'value' => default_host, 'encode' => false }
97
+ }
98
+ APIHelper.append_url_with_template_parameters(
99
+ ENVIRONMENTS[environment][server], parameters
100
+ )
101
+ end
102
+ end
103
+ 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
@@ -0,0 +1,60 @@
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
+ # BaseController.
8
+ class BaseController
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'APIMATIC 3.0'
14
+ end
15
+
16
+
17
+ GLOBAL_ERRORS = {
18
+ 'default' => ErrorCase.new
19
+ .error_message('HTTP response not OK.')
20
+ .exception_type(APIException)
21
+ }.freeze
22
+
23
+ # Initialization constructor.
24
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
25
+ def initialize(global_configuration)
26
+ @global_configuration = global_configuration
27
+ @config = @global_configuration.client_configuration
28
+ @http_call_back = @config.http_callback
29
+ @api_call = ApiCall.new(@global_configuration)
30
+ end
31
+
32
+ # Creates a new instance of the request builder.
33
+ # @param [String] http_method The HTTP method to use in the request.
34
+ # @param [String] path The endpoint path to use in the request.
35
+ # @param [String] server The server to extract the base uri for the request.
36
+ # @return [RequestBuilder] The instance of RequestBuilder.
37
+ def new_request_builder(http_method, path, server)
38
+ RequestBuilder.new
39
+ .http_method(http_method)
40
+ .path(path)
41
+ .server(server)
42
+ end
43
+
44
+ # Creates a new instance of the response handler.
45
+ # @return [ResponseHandler] The instance of ResponseHandler.
46
+ def new_response_handler
47
+ ResponseHandler.new
48
+ end
49
+
50
+ # Creates a new instance of the parameter.
51
+ # @param [String|optional] key The key of the parameter.
52
+ # @param [Object] value The value of the parameter.
53
+ # @return [Parameter] The instance of Parameter.
54
+ def new_parameter(value, key: nil)
55
+ Parameter.new
56
+ .key(key)
57
+ .value(value)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,21 @@
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
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ # Provides a human-readable string representation of the object.
10
+ def to_s
11
+ class_name = self.class.name.split('::').last
12
+ "<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
13
+ end
14
+
15
+ # Provides a debugging-friendly string with detailed object information.
16
+ def inspect
17
+ class_name = self.class.name.split('::').last
18
+ "<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
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
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,13 @@
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
+ end
13
+ end
@@ -0,0 +1,110 @@
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
+ # Base model.
8
+ # rubocop:disable all
9
+ class BaseModel < CoreLibrary::BaseModel
10
+ # Returns a Hash representation of the current object.
11
+ def to_hash
12
+ # validating the model being serialized
13
+ self.class.validate(self) if self.class.respond_to?(:validate)
14
+
15
+ hash = {}
16
+ instance_variables.each do |name|
17
+ value = instance_variable_get(name)
18
+ name = name[1..]
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
33
+ end
34
+
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
53
+ else
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ hash
60
+ end
61
+
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
103
+ # Returns a JSON representation of the curent object.
104
+ def to_json(options = {})
105
+ hash = to_hash
106
+ hash.to_json(options)
107
+ end
108
+ end
109
+ # rubocop:enable all
110
+ end
@@ -0,0 +1,26 @@
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
+ # CustomEnum.
8
+ class CustomEnum
9
+ CUSTOM_ENUM = [
10
+ # TODO: Write general description for VALUE1
11
+ VALUE1 = 'VALUE1'.freeze,
12
+
13
+ # TODO: Write general description for VALUE2
14
+ VALUE2 = 'VALUE2'.freeze,
15
+
16
+ # TODO: Write general description for VALUE3
17
+ VALUE3 = 'VALUE3'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ CUSTOM_ENUM.include?(value)
24
+ end
25
+ end
26
+ end