sonia-barrera-sdk 0.0.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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +71 -0
- data/lib/apimatic_calculator_zip/api_helper.rb +10 -0
- data/lib/apimatic_calculator_zip/client.rb +45 -0
- data/lib/apimatic_calculator_zip/configuration.rb +95 -0
- data/lib/apimatic_calculator_zip/controllers/base_controller.rb +60 -0
- data/lib/apimatic_calculator_zip/controllers/simple_calculator_controller.rb +33 -0
- data/lib/apimatic_calculator_zip/exceptions/api_exception.rb +21 -0
- data/lib/apimatic_calculator_zip/http/http_call_back.rb +10 -0
- data/lib/apimatic_calculator_zip/http/http_method_enum.rb +10 -0
- data/lib/apimatic_calculator_zip/http/http_request.rb +10 -0
- data/lib/apimatic_calculator_zip/http/http_response.rb +10 -0
- data/lib/apimatic_calculator_zip/http/proxy_settings.rb +13 -0
- data/lib/apimatic_calculator_zip/models/base_model.rb +110 -0
- data/lib/apimatic_calculator_zip/models/operation_type_enum.rb +29 -0
- data/lib/apimatic_calculator_zip/utilities/date_time_helper.rb +11 -0
- data/lib/apimatic_calculator_zip/utilities/file_wrapper.rb +28 -0
- data/lib/apimatic_calculator_zip.rb +41 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3c86bda1079d162d032b55ec250880bf3531583771eb5e7aed3d9469e27e235a
|
4
|
+
data.tar.gz: c8f29baae429886f15a6460e76d693a194d8115bf010d4dfb989e855129a37da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 464d9894782a4bd273f071fbfd29da58c20845c52718fe0103c1c72d26337f887d4da00046d8a6407bad754509ff8dfc8c9c148fe51d626c6bf33c9b4e8f17df
|
7
|
+
data.tar.gz: ee55b3a5da3ffcd1b97cf4512e13feddb5094bd7f539628d92d8fbeb7b3b3bcaf0589391b04dfe627063bcccfc4a1260dcf96e523966ec4dcf10c75fb3468b27
|
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,71 @@
|
|
1
|
+
|
2
|
+
# Getting Started with APIMATIC Calculator - zip
|
3
|
+
|
4
|
+
## Introduction
|
5
|
+
|
6
|
+
Simple calculator API hosted on APIMATIC for demo purposes
|
7
|
+
|
8
|
+
## Install the Package
|
9
|
+
|
10
|
+
Install the gem from the command line:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
gem install sonia-barrera-sdk -v 0.0.1
|
14
|
+
```
|
15
|
+
|
16
|
+
Or add the gem to your Gemfile and run `bundle`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'sonia-barrera-sdk', '0.0.1'
|
20
|
+
```
|
21
|
+
|
22
|
+
For additional gem details, see the [RubyGems page for the sonia-barrera-sdk gem](https://rubygems.org/gems/sonia-barrera-sdk/versions/0.0.1).
|
23
|
+
|
24
|
+
## Initialize the API Client
|
25
|
+
|
26
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/client.md)
|
27
|
+
|
28
|
+
The following parameters are configurable for the API Client:
|
29
|
+
|
30
|
+
| Parameter | Type | Description |
|
31
|
+
| --- | --- | --- |
|
32
|
+
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
33
|
+
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
34
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
35
|
+
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
36
|
+
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
37
|
+
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
38
|
+
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
39
|
+
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
40
|
+
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
41
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
42
|
+
|
43
|
+
The API client can be initialized as follows:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'apimatic_calculator_zip'
|
47
|
+
include ApimaticCalculatorZip
|
48
|
+
|
49
|
+
client = Client.new
|
50
|
+
```
|
51
|
+
|
52
|
+
## List of APIs
|
53
|
+
|
54
|
+
* [Simple Calculator](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/controllers/simple-calculator.md)
|
55
|
+
|
56
|
+
## SDK Infrastructure
|
57
|
+
|
58
|
+
### Configuration
|
59
|
+
|
60
|
+
* [ProxySettings](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
|
61
|
+
|
62
|
+
### HTTP
|
63
|
+
|
64
|
+
* [HttpResponse](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/http-response.md)
|
65
|
+
* [HttpRequest](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/http-request.md)
|
66
|
+
|
67
|
+
### Utilities
|
68
|
+
|
69
|
+
* [ApiHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/api-helper.md)
|
70
|
+
* [DateTimeHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
|
71
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
7
|
+
# apimatic_calculator_zip client class.
|
8
|
+
class Client
|
9
|
+
include CoreLibrary
|
10
|
+
attr_reader :config
|
11
|
+
|
12
|
+
# Access to simple_calculator controller.
|
13
|
+
# @return [SimpleCalculatorController] Returns the controller instance.
|
14
|
+
def simple_calculator
|
15
|
+
@simple_calculator ||= SimpleCalculatorController.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, config: nil
|
24
|
+
)
|
25
|
+
@config = if config.nil?
|
26
|
+
Configuration.new(connection: connection, adapter: adapter,
|
27
|
+
timeout: timeout, max_retries: max_retries,
|
28
|
+
retry_interval: retry_interval,
|
29
|
+
backoff_factor: backoff_factor,
|
30
|
+
retry_statuses: retry_statuses,
|
31
|
+
retry_methods: retry_methods,
|
32
|
+
http_callback: http_callback,
|
33
|
+
proxy_settings: proxy_settings,
|
34
|
+
environment: environment)
|
35
|
+
else
|
36
|
+
config
|
37
|
+
end
|
38
|
+
|
39
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
40
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
41
|
+
.global_errors(BaseController::GLOBAL_ERRORS)
|
42
|
+
.user_agent(BaseController.user_agent)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
7
|
+
# An enum for SDK environments.
|
8
|
+
class Environment
|
9
|
+
# PRODUCTION: This environment connect to the LIVE calculator API
|
10
|
+
ENVIRONMENT = [
|
11
|
+
PRODUCTION = 'production'.freeze
|
12
|
+
].freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
# An enum for API servers.
|
16
|
+
class Server
|
17
|
+
SERVER = [
|
18
|
+
DEFAULT = 'default'.freeze
|
19
|
+
].freeze
|
20
|
+
end
|
21
|
+
|
22
|
+
# All configuration including auth info and base URI for the API access
|
23
|
+
# are configured in this class.
|
24
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
25
|
+
# The attribute readers for properties.
|
26
|
+
attr_reader :environment
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_reader :environments
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(
|
33
|
+
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
34
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
35
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
36
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
37
|
+
environment: Environment::PRODUCTION
|
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
|
+
proxy_settings: proxy_settings
|
44
|
+
|
45
|
+
# Current API environment
|
46
|
+
@environment = String(environment)
|
47
|
+
|
48
|
+
# The Http Client to use for making requests.
|
49
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
50
|
+
end
|
51
|
+
|
52
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
53
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
54
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
55
|
+
proxy_settings: nil, environment: nil)
|
56
|
+
connection ||= self.connection
|
57
|
+
adapter ||= self.adapter
|
58
|
+
timeout ||= self.timeout
|
59
|
+
max_retries ||= self.max_retries
|
60
|
+
retry_interval ||= self.retry_interval
|
61
|
+
backoff_factor ||= self.backoff_factor
|
62
|
+
retry_statuses ||= self.retry_statuses
|
63
|
+
retry_methods ||= self.retry_methods
|
64
|
+
http_callback ||= self.http_callback
|
65
|
+
proxy_settings ||= self.proxy_settings
|
66
|
+
environment ||= self.environment
|
67
|
+
|
68
|
+
Configuration.new(connection: connection, adapter: adapter,
|
69
|
+
timeout: timeout, max_retries: max_retries,
|
70
|
+
retry_interval: retry_interval,
|
71
|
+
backoff_factor: backoff_factor,
|
72
|
+
retry_statuses: retry_statuses,
|
73
|
+
retry_methods: retry_methods,
|
74
|
+
http_callback: http_callback,
|
75
|
+
proxy_settings: proxy_settings,
|
76
|
+
environment: environment)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
# All the environments the SDK can run in.
|
81
|
+
ENVIRONMENTS = {
|
82
|
+
Environment::PRODUCTION => {
|
83
|
+
Server::DEFAULT => 'https://examples.apimatic.io/apps/calculator'
|
84
|
+
}
|
85
|
+
}.freeze
|
86
|
+
|
87
|
+
# Generates the appropriate base URI for the environment and the server.
|
88
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
89
|
+
# required.
|
90
|
+
# @return [String] The base URI.
|
91
|
+
def get_base_uri(server = Server::DEFAULT)
|
92
|
+
ENVIRONMENTS[environment][server].clone
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
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,33 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
7
|
+
# SimpleCalculatorController
|
8
|
+
class SimpleCalculatorController < BaseController
|
9
|
+
# Calculates the expression using the specified operation.
|
10
|
+
# @param [OperationTypeEnum] operation Required parameter: The operator to
|
11
|
+
# apply on the variables
|
12
|
+
# @param [Float] x Required parameter: The LHS value
|
13
|
+
# @param [Float] y Required parameter: The RHS value
|
14
|
+
# @return [Float] Response from the API call.
|
15
|
+
def calculate(operation,
|
16
|
+
x,
|
17
|
+
y)
|
18
|
+
@api_call
|
19
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
20
|
+
'/{operation}',
|
21
|
+
Server::DEFAULT)
|
22
|
+
.template_param(new_parameter(operation, key: 'operation')
|
23
|
+
.should_encode(true))
|
24
|
+
.query_param(new_parameter(x, key: 'x'))
|
25
|
+
.query_param(new_parameter(y, key: 'y')))
|
26
|
+
.response(new_response_handler
|
27
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
28
|
+
.deserialize_into(proc do |response| response&.to_f end)
|
29
|
+
.is_primitive_response(true))
|
30
|
+
.execute
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
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
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
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
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
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,29 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
7
|
+
# Possible operators are sum, subtract, multiply, divide
|
8
|
+
class OperationTypeEnum
|
9
|
+
OPERATION_TYPE_ENUM = [
|
10
|
+
# TODO: Write general description for SUM
|
11
|
+
SUM = 'SUM'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for SUBTRACT
|
14
|
+
SUBTRACT = 'SUBTRACT'.freeze,
|
15
|
+
|
16
|
+
# TODO: Write general description for MULTIPLY
|
17
|
+
MULTIPLY = 'MULTIPLY'.freeze,
|
18
|
+
|
19
|
+
# TODO: Write general description for DIVIDE
|
20
|
+
DIVIDE = 'DIVIDE'.freeze
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
def self.validate(value)
|
24
|
+
return false if value.nil?
|
25
|
+
|
26
|
+
OPERATION_TYPE_ENUM.include?(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module ApimaticCalculatorZip
|
8
|
+
# A utility that supports dateTime conversion to different formats
|
9
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculatorZip
|
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
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# apimatic_calculator_zip
|
2
|
+
#
|
3
|
+
# This file was automatically generated by
|
4
|
+
# APIMATIC v3.0 ( https://www.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 'apimatic_calculator_zip/api_helper'
|
14
|
+
require_relative 'apimatic_calculator_zip/client'
|
15
|
+
|
16
|
+
# Utilities
|
17
|
+
require_relative 'apimatic_calculator_zip/utilities/file_wrapper'
|
18
|
+
require_relative 'apimatic_calculator_zip/utilities/date_time_helper'
|
19
|
+
|
20
|
+
# Http
|
21
|
+
require_relative 'apimatic_calculator_zip/http/http_call_back'
|
22
|
+
require_relative 'apimatic_calculator_zip/http/http_method_enum'
|
23
|
+
require_relative 'apimatic_calculator_zip/http/http_request'
|
24
|
+
require_relative 'apimatic_calculator_zip/http/http_response'
|
25
|
+
require_relative 'apimatic_calculator_zip/http/proxy_settings'
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# Models
|
30
|
+
require_relative 'apimatic_calculator_zip/models/base_model'
|
31
|
+
require_relative 'apimatic_calculator_zip/models/operation_type_enum'
|
32
|
+
|
33
|
+
# Exceptions
|
34
|
+
require_relative 'apimatic_calculator_zip/exceptions/api_exception'
|
35
|
+
|
36
|
+
require_relative 'apimatic_calculator_zip/configuration'
|
37
|
+
|
38
|
+
# Controllers
|
39
|
+
require_relative 'apimatic_calculator_zip/controllers/base_controller'
|
40
|
+
require_relative 'apimatic_calculator_zip/controllers/' \
|
41
|
+
'simple_calculator_controller'
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sonia-barrera-sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zahra naseem
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-09-12 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.2
|
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.2
|
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.19
|
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.19
|
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.6
|
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.6
|
55
|
+
description: Vel dolores harum ip
|
56
|
+
email:
|
57
|
+
- kawanyqum@mailinator.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
- lib/apimatic_calculator_zip.rb
|
65
|
+
- lib/apimatic_calculator_zip/api_helper.rb
|
66
|
+
- lib/apimatic_calculator_zip/client.rb
|
67
|
+
- lib/apimatic_calculator_zip/configuration.rb
|
68
|
+
- lib/apimatic_calculator_zip/controllers/base_controller.rb
|
69
|
+
- lib/apimatic_calculator_zip/controllers/simple_calculator_controller.rb
|
70
|
+
- lib/apimatic_calculator_zip/exceptions/api_exception.rb
|
71
|
+
- lib/apimatic_calculator_zip/http/http_call_back.rb
|
72
|
+
- lib/apimatic_calculator_zip/http/http_method_enum.rb
|
73
|
+
- lib/apimatic_calculator_zip/http/http_request.rb
|
74
|
+
- lib/apimatic_calculator_zip/http/http_response.rb
|
75
|
+
- lib/apimatic_calculator_zip/http/proxy_settings.rb
|
76
|
+
- lib/apimatic_calculator_zip/models/base_model.rb
|
77
|
+
- lib/apimatic_calculator_zip/models/operation_type_enum.rb
|
78
|
+
- lib/apimatic_calculator_zip/utilities/date_time_helper.rb
|
79
|
+
- lib/apimatic_calculator_zip/utilities/file_wrapper.rb
|
80
|
+
homepage: https://www.qocuqy.cc
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.6'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubygems_version: 3.1.6
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: test
|
103
|
+
test_files: []
|