test-qaaaaaa-sdk 1.2.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e0edadd3c4eb0edf9beb5b3c0c72283f9233d9bf7cbeb2e8d7fb3aac783cff65
4
+ data.tar.gz: 8c13ec04fa3a2b95da7ff2d28d1974fb8b8bd5a628b21bae55f7bbc7fd1d3895
5
+ SHA512:
6
+ metadata.gz: fff564c5c8285ad080f8ea35b06eff3d7d2fc67d74b465e89ff2ea591602846bfced8c38d3c914e99c2c567bdca1bf70d2588e1f140e98df994962ec15fbcd90
7
+ data.tar.gz: 51bc68065a273ea86490ce7709cd70199d86c35508c6f16dca8189515b909d15857696235cee1dc34897b80389335a1850dcb356b00b3b078bfd5e7cfb7c0ebe
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,72 @@
1
+
2
+ # Getting Started with Test API
3
+
4
+ ## Install the Package
5
+
6
+ Install the gem from the command line:
7
+
8
+ ```bash
9
+ gem install test-qaaaaaa-sdk -v 1.2.3
10
+ ```
11
+
12
+ Or add the gem to your Gemfile and run `bundle`:
13
+
14
+ ```ruby
15
+ gem 'test-qaaaaaa-sdk', '1.2.3'
16
+ ```
17
+
18
+ For additional gem details, see the [RubyGems page for the test-qaaaaaa-sdk gem](https://rubygems.org/gems/test-qaaaaaa-sdk/versions/1.2.3).
19
+
20
+ ## Test the SDK
21
+
22
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
23
+
24
+ ```
25
+ rake
26
+ ```
27
+
28
+ ## Initialize the API Client
29
+
30
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/client.md)
31
+
32
+ The following parameters are configurable for the API Client:
33
+
34
+ | Parameter | Type | Description |
35
+ | --- | --- | --- |
36
+ | default_host | `String` | *Default*: `'www.example.com'` |
37
+ | environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
38
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
39
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
40
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
41
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
42
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
43
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
44
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
45
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
46
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
47
+
48
+ The API client can be initialized as follows:
49
+
50
+ ```ruby
51
+ client = TestApi::Client.new(
52
+ environment: Environment::PRODUCTION,
53
+ default_host: 'www.example.com'
54
+ )
55
+ ```
56
+
57
+ ## List of APIs
58
+
59
+ * [API](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/controllers/api.md)
60
+
61
+ ## SDK Infrastructure
62
+
63
+ ### HTTP
64
+
65
+ * [HttpResponse](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/http-response.md)
66
+ * [HttpRequest](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/http-request.md)
67
+
68
+ ### Utilities
69
+
70
+ * [ApiHelper](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/api-helper.md)
71
+ * [DateTimeHelper](https://www.github.com/tahaali2000/test-qaaaaaa-ruby-sdk/tree/1.2.3/doc/date-time-helper.md)
72
+
@@ -0,0 +1,10 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,46 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # 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,
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
+ environment: environment,
35
+ default_host: default_host)
36
+ else
37
+ config
38
+ end
39
+
40
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
41
+ .base_uri_executor(@config.method(:get_base_uri))
42
+ .global_errors(BaseController::GLOBAL_ERRORS)
43
+ .user_agent(BaseController.user_agent)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,101 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
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,
36
+ environment: Environment::PRODUCTION, default_host: 'www.example.com'
37
+ )
38
+
39
+ super connection: connection, adapter: adapter, timeout: timeout,
40
+ max_retries: max_retries, retry_interval: retry_interval,
41
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
42
+ retry_methods: retry_methods, http_callback: http_callback
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
+ 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
+ environment ||= self.environment
68
+ default_host ||= self.default_host
69
+
70
+ Configuration.new(connection: connection, adapter: adapter,
71
+ timeout: timeout, max_retries: max_retries,
72
+ retry_interval: retry_interval,
73
+ backoff_factor: backoff_factor,
74
+ retry_statuses: retry_statuses,
75
+ retry_methods: retry_methods,
76
+ http_callback: http_callback, environment: environment,
77
+ default_host: default_host)
78
+ end
79
+
80
+
81
+ # All the environments the SDK can run in.
82
+ ENVIRONMENTS = {
83
+ Environment::PRODUCTION => {
84
+ Server::DEFAULT => 'https://{defaultHost}'
85
+ }
86
+ }.freeze
87
+
88
+ # Generates the appropriate base URI for the environment and the server.
89
+ # @param [Configuration::Server] server The server enum for which the base URI is
90
+ # required.
91
+ # @return [String] The base URI.
92
+ def get_base_uri(server = Server::DEFAULT)
93
+ parameters = {
94
+ 'defaultHost' => { 'value' => default_host, 'encode' => false }
95
+ }
96
+ APIHelper.append_url_with_template_parameters(
97
+ ENVIRONMENTS[environment][server], parameters
98
+ )
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,49 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # APIController
8
+ class APIController < BaseController
9
+ # Returns a list of users, optionally filtered by search.
10
+ # @param [String] search Optional parameter: Filter users by search term
11
+ # @param [Integer] limit Optional parameter: Limit the number of users
12
+ # returned
13
+ # @return [Array[UsersResponse]] response from the API call.
14
+ def getusers(search: nil,
15
+ limit: nil)
16
+ new_api_call_builder
17
+ .request(new_request_builder(HttpMethodEnum::GET,
18
+ '/users',
19
+ Server::DEFAULT)
20
+ .query_param(new_parameter(search, key: 'search'))
21
+ .query_param(new_parameter(limit, key: 'limit'))
22
+ .header_param(new_parameter('application/json', key: 'accept')))
23
+ .response(new_response_handler
24
+ .deserializer(APIHelper.method(:custom_type_deserializer))
25
+ .deserialize_into(UsersResponse.method(:from_hash))
26
+ .is_response_array(true))
27
+ .execute
28
+ end
29
+
30
+ # Creates a user with default values if not provided.
31
+ # @param [UsersRequest] body Required parameter: TODO: type description
32
+ # here
33
+ # @return [UsersResponse1] response from the API call.
34
+ def createanewuser(body)
35
+ new_api_call_builder
36
+ .request(new_request_builder(HttpMethodEnum::POST,
37
+ '/users',
38
+ Server::DEFAULT)
39
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
40
+ .body_param(new_parameter(body))
41
+ .header_param(new_parameter('application/json', key: 'accept'))
42
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
43
+ .response(new_response_handler
44
+ .deserializer(APIHelper.method(:custom_type_deserializer))
45
+ .deserialize_into(UsersResponse1.method(:from_hash)))
46
+ .execute
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,66 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
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 builder for the Api Call instance.
33
+ # @return [ApiCall] The instance of ApiCall.
34
+ def new_api_call_builder
35
+ @api_call.new_builder
36
+ end
37
+
38
+ # Creates a new instance of the request builder.
39
+ # @param [String] http_method The HTTP method to use in the request.
40
+ # @param [String] path The endpoint path to use in the request.
41
+ # @param [String] server The server to extract the base uri for the request.
42
+ # @return [RequestBuilder] The instance of RequestBuilder.
43
+ def new_request_builder(http_method, path, server)
44
+ RequestBuilder.new
45
+ .http_method(http_method)
46
+ .path(path)
47
+ .server(server)
48
+ end
49
+
50
+ # Creates a new instance of the response handler.
51
+ # @return [ResponseHandler] The instance of ResponseHandler.
52
+ def new_response_handler
53
+ ResponseHandler.new
54
+ end
55
+
56
+ # Creates a new instance of the parameter.
57
+ # @param [String|optional] key The key of the parameter.
58
+ # @param [Object] value The value of the parameter.
59
+ # @return [Parameter] The instance of Parameter.
60
+ def new_parameter(value, key: nil)
61
+ Parameter.new
62
+ .key(key)
63
+ .value(value)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,21 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
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
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
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
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,110 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
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,99 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # UsersRequest Model.
8
+ class UsersRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # User's username
13
+ # @return [String]
14
+ attr_accessor :username
15
+
16
+ # User's age
17
+ # @return [Integer]
18
+ attr_accessor :age
19
+
20
+ # Whether the user is active
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :is_active
23
+
24
+ # User's rating
25
+ # @return [Float]
26
+ attr_accessor :rating
27
+
28
+ # Signup date
29
+ # @return [Date]
30
+ attr_accessor :signup_date
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['username'] = 'username'
36
+ @_hash['age'] = 'age'
37
+ @_hash['is_active'] = 'isActive'
38
+ @_hash['rating'] = 'rating'
39
+ @_hash['signup_date'] = 'signupDate'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ username
47
+ is_active
48
+ rating
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(age = nil, signup_date = nil, username = SKIP,
58
+ is_active = SKIP, rating = SKIP)
59
+ @username = username unless username == SKIP
60
+ @age = age
61
+ @is_active = is_active unless is_active == SKIP
62
+ @rating = rating unless rating == SKIP
63
+ @signup_date = signup_date
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ age = hash.key?('age') ? hash['age'] : nil
72
+ signup_date = hash.key?('signupDate') ? hash['signupDate'] : nil
73
+ username = hash.key?('username') ? hash['username'] : SKIP
74
+ is_active = hash.key?('isActive') ? hash['isActive'] : SKIP
75
+ rating = hash.key?('rating') ? hash['rating'] : SKIP
76
+
77
+ # Create object from extracted values.
78
+ UsersRequest.new(age,
79
+ signup_date,
80
+ username,
81
+ is_active,
82
+ rating)
83
+ end
84
+
85
+ # Provides a human-readable string representation of the object.
86
+ def to_s
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} username: #{@username}, age: #{@age}, is_active: #{@is_active}, rating:"\
89
+ " #{@rating}, signup_date: #{@signup_date}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} username: #{@username.inspect}, age: #{@age.inspect}, is_active:"\
96
+ " #{@is_active.inspect}, rating: #{@rating.inspect}, signup_date: #{@signup_date.inspect}>"
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,71 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # UsersResponse Model.
8
+ class UsersResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :name
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['id'] = 'id'
24
+ @_hash['name'] = 'name'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ id
32
+ name
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(id = SKIP, name = SKIP)
42
+ @id = id unless id == SKIP
43
+ @name = name unless name == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ id = hash.key?('id') ? hash['id'] : SKIP
52
+ name = hash.key?('name') ? hash['name'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ UsersResponse.new(id,
56
+ name)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} id: #{@id}, name: #{@name}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # UsersResponse1 Model.
8
+ class UsersResponse1 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :message
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['id'] = 'id'
24
+ @_hash['message'] = 'message'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ id
32
+ message
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(id = SKIP, message = SKIP)
42
+ @id = id unless id == SKIP
43
+ @message = message unless message == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ id = hash.key?('id') ? hash['id'] : SKIP
52
+ message = hash.key?('message') ? hash['message'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ UsersResponse1.new(id,
56
+ message)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} id: #{@id}, message: #{@message}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} id: #{@id.inspect}, message: #{@message.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,11 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module TestApi
8
+ # A utility that supports dateTime conversion to different formats
9
+ class DateTimeHelper < CoreLibrary::DateTimeHelper
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module TestApi
7
+ # A utility to allow users to set the content-type for files
8
+ class FileWrapper < CoreLibrary::FileWrapper
9
+ # The constructor.
10
+ # @param [File] file The file to be sent in the request.
11
+ # @param [string] content_type The content type of the provided file.
12
+ def initialize(file, content_type: 'application/octet-stream')
13
+ super
14
+ end
15
+
16
+ # Provides a human-readable string representation of the object.
17
+ def to_s
18
+ class_name = self.class.name.split('::').last
19
+ "<#{class_name} file: #{@file}, content_type: #{@content_type}>"
20
+ end
21
+
22
+ # Provides a debugging-friendly string with detailed object information.
23
+ def to_inspect
24
+ class_name = self.class.name.split('::').last
25
+ "<#{class_name} file: #{@file.inspect}, content_type: #{@content_type.inspect}>"
26
+ end
27
+ end
28
+ end
data/lib/test_api.rb ADDED
@@ -0,0 +1,41 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ require 'json'
8
+
9
+ require 'apimatic_core_interfaces'
10
+ require 'apimatic_core'
11
+ require 'apimatic_faraday_client_adapter'
12
+
13
+ require_relative 'test_api/api_helper'
14
+ require_relative 'test_api/client'
15
+
16
+ # Utilities
17
+ require_relative 'test_api/utilities/file_wrapper'
18
+ require_relative 'test_api/utilities/date_time_helper'
19
+
20
+ # Http
21
+ require_relative 'test_api/http/http_call_back'
22
+ require_relative 'test_api/http/http_method_enum'
23
+ require_relative 'test_api/http/http_request'
24
+ require_relative 'test_api/http/http_response'
25
+
26
+ # Logger
27
+
28
+ # Models
29
+ require_relative 'test_api/models/base_model'
30
+ require_relative 'test_api/models/users_request'
31
+ require_relative 'test_api/models/users_response1'
32
+ require_relative 'test_api/models/users_response'
33
+
34
+ # Exceptions
35
+ require_relative 'test_api/exceptions/api_exception'
36
+
37
+ require_relative 'test_api/configuration'
38
+
39
+ # Controllers
40
+ require_relative 'test_api/controllers/base_controller'
41
+ require_relative 'test_api/controllers/api_controller'
@@ -0,0 +1,29 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'json'
7
+ require 'minitest/autorun'
8
+ require 'minitest/hell'
9
+ require 'minitest/pride'
10
+ require 'minitest/proveit'
11
+ require 'test_api'
12
+ require_relative '../http_response_catcher'
13
+
14
+ class ControllerTestBase < Minitest::Test
15
+ parallelize_me!
16
+ include TestApi
17
+ include CoreLibrary
18
+
19
+ # Create configuration and set any test parameters
20
+ def create_configuration
21
+ Configuration.new(http_callback: HttpResponseCatcher.new)
22
+ end
23
+
24
+ # Initializes the base test controller
25
+ def setup_class
26
+ _config = create_configuration
27
+ @client = Client.new(config: _config)
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require_relative 'controller_test_base'
7
+
8
+ class APIControllerTest < ControllerTestBase
9
+ # Called only once for the class before any test has executed
10
+ def setup
11
+ setup_class
12
+ @controller = @client.client
13
+ @response_catcher = @controller.http_call_back
14
+ end
15
+
16
+ # Returns a list of users, optionally filtered by search.
17
+ def test_getusers
18
+ # Parameters for the API call
19
+ search = nil
20
+ limit = nil
21
+
22
+ # Perform the API call through the SDK function
23
+ result = @controller.getusers(search: search, limit: limit)
24
+
25
+ # Test response code
26
+ assert_equal(200, @response_catcher.response.status_code)
27
+ # Test headers
28
+ expected_headers = {}
29
+ expected_headers['content-type'] = 'application/json'
30
+
31
+ assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
32
+ end
33
+
34
+ end
@@ -0,0 +1,19 @@
1
+ # test_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ class HttpResponseCatcher < TestApi::HttpCallBack
7
+ attr_accessor :response
8
+
9
+ def on_before_request(request)
10
+ end
11
+
12
+ # Catching the response
13
+ def on_after_response(response)
14
+ @response = response
15
+ end
16
+ end
17
+
18
+
19
+
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test-qaaaaaa-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Taha
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-05-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: apimatic_core_interfaces
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: apimatic_core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.11
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.11
41
+ - !ruby/object:Gem::Dependency
42
+ name: apimatic_faraday_client_adapter
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 5.24.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 5.24.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-proveit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ description: test
84
+ email:
85
+ - taha.ali@apimatic.io
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - LICENSE
91
+ - README.md
92
+ - lib/test_api.rb
93
+ - lib/test_api/api_helper.rb
94
+ - lib/test_api/client.rb
95
+ - lib/test_api/configuration.rb
96
+ - lib/test_api/controllers/api_controller.rb
97
+ - lib/test_api/controllers/base_controller.rb
98
+ - lib/test_api/exceptions/api_exception.rb
99
+ - lib/test_api/http/http_call_back.rb
100
+ - lib/test_api/http/http_method_enum.rb
101
+ - lib/test_api/http/http_request.rb
102
+ - lib/test_api/http/http_response.rb
103
+ - lib/test_api/models/base_model.rb
104
+ - lib/test_api/models/users_request.rb
105
+ - lib/test_api/models/users_response.rb
106
+ - lib/test_api/models/users_response1.rb
107
+ - lib/test_api/utilities/date_time_helper.rb
108
+ - lib/test_api/utilities/file_wrapper.rb
109
+ - test/controllers/controller_test_base.rb
110
+ - test/controllers/test_api_controller.rb
111
+ - test/http_response_catcher.rb
112
+ homepage: https://app.dev.apimatic.io/Account/Login?ReturnUrl=%2Fdashboard
113
+ licenses:
114
+ - MIT
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '2.6'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubygems_version: 3.1.6
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: test
135
+ test_files: []