calculator_test2 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +64 -0
- data/lib/apimatic_calculator/api_helper.rb +10 -0
- data/lib/apimatic_calculator/client.rb +56 -0
- data/lib/apimatic_calculator/configuration.rb +94 -0
- data/lib/apimatic_calculator/controllers/base_controller.rb +65 -0
- data/lib/apimatic_calculator/controllers/simple_calculator_controller.rb +34 -0
- data/lib/apimatic_calculator/exceptions/api_exception.rb +10 -0
- data/lib/apimatic_calculator/http/auth/o_auth2.rb +24 -0
- data/lib/apimatic_calculator/http/http_call_back.rb +10 -0
- data/lib/apimatic_calculator/http/http_method_enum.rb +10 -0
- data/lib/apimatic_calculator/http/http_request.rb +10 -0
- data/lib/apimatic_calculator/http/http_response.rb +10 -0
- data/lib/apimatic_calculator/models/base_model.rb +58 -0
- data/lib/apimatic_calculator/models/operation_type_enum.rb +23 -0
- data/lib/apimatic_calculator/utilities/date_time_helper.rb +11 -0
- data/lib/apimatic_calculator/utilities/file_wrapper.rb +16 -0
- data/lib/apimatic_calculator.rb +40 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5447dee2ea17a3a270d4a6210afda081d213db85b5a6d67ef216d6241a0539a9
|
4
|
+
data.tar.gz: 256f85b1ec205fde93ac3590966bbf0258b03914f8da8096b002019fa97dab6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 73d7ddb9f66c0e8a5c9616b37b4ea63840b6ab3bd771ebab59bbd7fbca1c620a83e3444382fecbd18a43dd502eff63d77be5f22063ee97b62209a06909421a2a
|
7
|
+
data.tar.gz: 143a144128167085c2695f9cfeba2cfc50ec687f7e16cb3d0be8630891b7b929aaa06a9cbe174387955e8167551f7831906dff2137dc1cd4449e772858e27e32
|
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 - 2023 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,64 @@
|
|
1
|
+
|
2
|
+
# Getting Started with APIMATIC Calculator
|
3
|
+
|
4
|
+
## Introduction
|
5
|
+
|
6
|
+
Simple calculator API hosted on APIMATIC
|
7
|
+
|
8
|
+
## Install the Package
|
9
|
+
|
10
|
+
Install the gem from the command line:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem install calculator_test2 -v 1.0
|
14
|
+
```
|
15
|
+
|
16
|
+
Or add the gem to your Gemfile and run `bundle`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'calculator_test2', '1.0'
|
20
|
+
```
|
21
|
+
|
22
|
+
For additional gem details, see the [RubyGems page for the calculator_test2 gem](https://rubygems.org/gems/calculator_test2/versions/1.0).
|
23
|
+
|
24
|
+
## Initialize the API Client
|
25
|
+
|
26
|
+
**_Note:_** Documentation for the client can be found [here.](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
|
+
| `access_token` | `String` | The OAuth 2.0 Access Token to use for API requests. |
|
42
|
+
|
43
|
+
The API client can be initialized as follows:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
client = ApimaticCalculator::Client.new(
|
47
|
+
access_token: 'AccessToken',
|
48
|
+
)
|
49
|
+
```
|
50
|
+
|
51
|
+
## Authorization
|
52
|
+
|
53
|
+
This API uses `OAuth 2 Bearer token`.
|
54
|
+
|
55
|
+
## List of APIs
|
56
|
+
|
57
|
+
* [Simple Calculator](doc/controllers/simple-calculator.md)
|
58
|
+
|
59
|
+
## Classes Documentation
|
60
|
+
|
61
|
+
* [Utility Classes](doc/utility-classes.md)
|
62
|
+
* [HttpResponse](doc/http-response.md)
|
63
|
+
* [HttpRequest](doc/http-request.md)
|
64
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# apimatic_calculator client class.
|
8
|
+
class Client
|
9
|
+
attr_reader :config, :auth_managers
|
10
|
+
|
11
|
+
# Access to simple_calculator controller.
|
12
|
+
# @return [SimpleCalculatorController] Returns the controller instance.
|
13
|
+
def simple_calculator
|
14
|
+
@simple_calculator ||= SimpleCalculatorController.new @global_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(connection: nil, adapter: :net_http_persistent, timeout: 60,
|
18
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
19
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
20
|
+
retry_methods: %i[get put], http_callback: nil,
|
21
|
+
environment: Environment::PRODUCTION, access_token: '',
|
22
|
+
config: nil)
|
23
|
+
@config = if config.nil?
|
24
|
+
Configuration.new(connection: connection, adapter: adapter,
|
25
|
+
timeout: timeout, max_retries: max_retries,
|
26
|
+
retry_interval: retry_interval,
|
27
|
+
backoff_factor: backoff_factor,
|
28
|
+
retry_statuses: retry_statuses,
|
29
|
+
retry_methods: retry_methods,
|
30
|
+
http_callback: http_callback,
|
31
|
+
environment: environment,
|
32
|
+
access_token: access_token)
|
33
|
+
else
|
34
|
+
config
|
35
|
+
end
|
36
|
+
|
37
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
38
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
39
|
+
.global_errors(BaseController::GLOBAL_ERRORS)
|
40
|
+
.user_agent(BaseController.user_agent)
|
41
|
+
.sdk_module(ApimaticCalculator)
|
42
|
+
|
43
|
+
initialize_auth_managers(@global_configuration)
|
44
|
+
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the auth managers hash used for authenticating API calls.
|
48
|
+
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
49
|
+
def initialize_auth_managers(global_config)
|
50
|
+
@auth_managers = {}
|
51
|
+
http_client_config = global_config.client_configuration
|
52
|
+
['global'].each { |auth| @auth_managers[auth] = nil }
|
53
|
+
@auth_managers['global'] = OAuth2.new(http_client_config.access_token)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
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, :access_token
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_reader :environments
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(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, access_token: '')
|
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
|
+
|
43
|
+
# Current API environment
|
44
|
+
@environment = String(environment)
|
45
|
+
|
46
|
+
# The OAuth 2.0 Access Token to use for API requests.
|
47
|
+
@access_token = access_token
|
48
|
+
|
49
|
+
# The Http Client to use for making requests.
|
50
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
51
|
+
end
|
52
|
+
|
53
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
54
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
55
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
56
|
+
environment: nil, access_token: nil)
|
57
|
+
connection ||= self.connection
|
58
|
+
adapter ||= self.adapter
|
59
|
+
timeout ||= self.timeout
|
60
|
+
max_retries ||= self.max_retries
|
61
|
+
retry_interval ||= self.retry_interval
|
62
|
+
backoff_factor ||= self.backoff_factor
|
63
|
+
retry_statuses ||= self.retry_statuses
|
64
|
+
retry_methods ||= self.retry_methods
|
65
|
+
http_callback ||= self.http_callback
|
66
|
+
environment ||= self.environment
|
67
|
+
access_token ||= self.access_token
|
68
|
+
|
69
|
+
Configuration.new(connection: connection, adapter: adapter,
|
70
|
+
timeout: timeout, max_retries: max_retries,
|
71
|
+
retry_interval: retry_interval,
|
72
|
+
backoff_factor: backoff_factor,
|
73
|
+
retry_statuses: retry_statuses,
|
74
|
+
retry_methods: retry_methods,
|
75
|
+
http_callback: http_callback, environment: environment,
|
76
|
+
access_token: access_token)
|
77
|
+
end
|
78
|
+
|
79
|
+
# All the environments the SDK can run in.
|
80
|
+
ENVIRONMENTS = {
|
81
|
+
Environment::PRODUCTION => {
|
82
|
+
Server::DEFAULT => 'https://examples.apimatic.io/apps/calculator'
|
83
|
+
}
|
84
|
+
}.freeze
|
85
|
+
|
86
|
+
# Generates the appropriate base URI for the environment and the server.
|
87
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
88
|
+
# required.
|
89
|
+
# @return [String] The base URI.
|
90
|
+
def get_base_uri(server = Server::DEFAULT)
|
91
|
+
ENVIRONMENTS[environment][server].clone
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# BaseController.
|
8
|
+
class BaseController
|
9
|
+
attr_accessor :config, :http_call_back
|
10
|
+
|
11
|
+
def self.user_agent
|
12
|
+
'APIMATIC 3.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
GLOBAL_ERRORS = {
|
17
|
+
'default' => ErrorCase.new
|
18
|
+
.error_message('HTTP response not OK.')
|
19
|
+
.exception_type(APIException)
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
# Initialization constructor.
|
23
|
+
# @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
|
24
|
+
def initialize(global_configuration)
|
25
|
+
@global_configuration = global_configuration
|
26
|
+
@config = @global_configuration.client_configuration
|
27
|
+
@http_call_back = @config.http_callback
|
28
|
+
@api_call = ApiCall.new(@global_configuration)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates a new builder for the Api Call instance.
|
32
|
+
# @return [ApiCall] The instance of ApiCall.
|
33
|
+
def new_api_call_builder
|
34
|
+
@api_call.new_builder
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates a new instance of the request builder.
|
38
|
+
# @param [HttpMethodEnum] http_method The HTTP method to use in the request.
|
39
|
+
# @param [String] path The endpoint path to use in the request.
|
40
|
+
# @param [String] server The server to extract the base uri for the request.
|
41
|
+
# @return [RequestBuilder] The instance of RequestBuilder.
|
42
|
+
def new_request_builder(http_method, path, server)
|
43
|
+
RequestBuilder.new
|
44
|
+
.http_method(http_method)
|
45
|
+
.path(path)
|
46
|
+
.server(server)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Creates a new instance of the response handler.
|
50
|
+
# @return [ResponseHandler] The instance of ResponseHandler.
|
51
|
+
def new_response_handler
|
52
|
+
ResponseHandler.new
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates a new instance of the parameter.
|
56
|
+
# @param [String|optional] key The key of the parameter.
|
57
|
+
# @param [Object] value The value of the parameter.
|
58
|
+
# @return [Parameter] The instance of Parameter.
|
59
|
+
def new_parameter(value, key: nil)
|
60
|
+
Parameter.new
|
61
|
+
.key(key)
|
62
|
+
.value(value)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
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
|
+
new_api_call_builder
|
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
|
+
.auth(Single.new('global')))
|
27
|
+
.response(new_response_handler
|
28
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
29
|
+
.deserialize_into(proc do |response| response.to_f end)
|
30
|
+
.is_primitive_response(true))
|
31
|
+
.execute
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < CoreLibrary::ApiException
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# Utility class for OAuth 2 authorization and token management.
|
8
|
+
class OAuth2 < CoreLibrary::HeaderAuth
|
9
|
+
# Display error message on occurrence of authentication failure.
|
10
|
+
# @returns [String] The oAuth error message.
|
11
|
+
def error_message
|
12
|
+
'BearerAuth: access_token is undefined.'
|
13
|
+
end
|
14
|
+
|
15
|
+
# Initialization constructor.
|
16
|
+
def initialize(access_token)
|
17
|
+
auth_params = {}
|
18
|
+
@_access_token = access_token
|
19
|
+
auth_params['Authorization'] = "Bearer #{@_access_token}" unless @_access_token.nil?
|
20
|
+
|
21
|
+
super auth_params
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# Base model.
|
8
|
+
class BaseModel < CoreLibrary::BaseModel
|
9
|
+
# Returns a Hash representation of the current object.
|
10
|
+
def to_hash
|
11
|
+
hash = {}
|
12
|
+
instance_variables.each do |name|
|
13
|
+
value = instance_variable_get(name)
|
14
|
+
name = name[1..]
|
15
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
16
|
+
|
17
|
+
optional_fields = self.class.optionals
|
18
|
+
nullable_fields = self.class.nullables
|
19
|
+
if value.nil?
|
20
|
+
next unless nullable_fields.include?(name)
|
21
|
+
|
22
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
23
|
+
raise ArgumentError,
|
24
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
hash[key] = nil
|
29
|
+
unless value.nil?
|
30
|
+
if respond_to?("to_#{name}")
|
31
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
32
|
+
params = [hash, key]
|
33
|
+
hash[key] = send("to_#{name}", *params)
|
34
|
+
else
|
35
|
+
hash[key] = send("to_#{name}")
|
36
|
+
end
|
37
|
+
elsif value.instance_of? Array
|
38
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
39
|
+
elsif value.instance_of? Hash
|
40
|
+
hash[key] = {}
|
41
|
+
value.each do |k, v|
|
42
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
43
|
+
end
|
44
|
+
else
|
45
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
hash
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns a JSON representation of the curent object.
|
53
|
+
def to_json(options = {})
|
54
|
+
hash = to_hash
|
55
|
+
hash.to_json(options)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
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
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module ApimaticCalculator
|
8
|
+
# A utility that supports dateTime conversion to different formats
|
9
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
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
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
require 'json'
|
8
|
+
require 'apimatic_core_interfaces'
|
9
|
+
require 'apimatic_core'
|
10
|
+
require 'apimatic_faraday_client_adapter'
|
11
|
+
# rubocop:disable Style/MixinUsage
|
12
|
+
include CoreLibrary
|
13
|
+
# rubocop:enable Style/MixinUsage
|
14
|
+
|
15
|
+
require_relative 'apimatic_calculator/api_helper'
|
16
|
+
require_relative 'apimatic_calculator/client'
|
17
|
+
|
18
|
+
# Utilities
|
19
|
+
require_relative 'apimatic_calculator/utilities/file_wrapper'
|
20
|
+
require_relative 'apimatic_calculator/utilities/date_time_helper'
|
21
|
+
|
22
|
+
# Http
|
23
|
+
require_relative 'apimatic_calculator/http/http_call_back'
|
24
|
+
require_relative 'apimatic_calculator/http/http_method_enum'
|
25
|
+
require_relative 'apimatic_calculator/http/http_request'
|
26
|
+
require_relative 'apimatic_calculator/http/http_response'
|
27
|
+
require_relative 'apimatic_calculator/http/auth/o_auth2'
|
28
|
+
|
29
|
+
# Models
|
30
|
+
require_relative 'apimatic_calculator/models/base_model'
|
31
|
+
require_relative 'apimatic_calculator/models/operation_type_enum'
|
32
|
+
|
33
|
+
# Exceptions
|
34
|
+
require_relative 'apimatic_calculator/exceptions/api_exception'
|
35
|
+
|
36
|
+
require_relative 'apimatic_calculator/configuration'
|
37
|
+
|
38
|
+
# Controllers
|
39
|
+
require_relative 'apimatic_calculator/controllers/base_controller'
|
40
|
+
require_relative 'apimatic_calculator/controllers/simple_calculator_controller'
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calculator_test2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- APIMatic SDK Generator
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-16 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.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
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.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
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.0
|
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.0
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- support@apimatic.io
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
- lib/apimatic_calculator.rb
|
65
|
+
- lib/apimatic_calculator/api_helper.rb
|
66
|
+
- lib/apimatic_calculator/client.rb
|
67
|
+
- lib/apimatic_calculator/configuration.rb
|
68
|
+
- lib/apimatic_calculator/controllers/base_controller.rb
|
69
|
+
- lib/apimatic_calculator/controllers/simple_calculator_controller.rb
|
70
|
+
- lib/apimatic_calculator/exceptions/api_exception.rb
|
71
|
+
- lib/apimatic_calculator/http/auth/o_auth2.rb
|
72
|
+
- lib/apimatic_calculator/http/http_call_back.rb
|
73
|
+
- lib/apimatic_calculator/http/http_method_enum.rb
|
74
|
+
- lib/apimatic_calculator/http/http_request.rb
|
75
|
+
- lib/apimatic_calculator/http/http_response.rb
|
76
|
+
- lib/apimatic_calculator/models/base_model.rb
|
77
|
+
- lib/apimatic_calculator/models/operation_type_enum.rb
|
78
|
+
- lib/apimatic_calculator/utilities/date_time_helper.rb
|
79
|
+
- lib/apimatic_calculator/utilities/file_wrapper.rb
|
80
|
+
homepage: ''
|
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
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.7.6
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: apimatic_calculator
|
104
|
+
test_files: []
|