mannual-calculator 1.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 +105 -0
- data/lib/manualpractice_sample_api/api_helper.rb +10 -0
- data/lib/manualpractice_sample_api/apis/addnumbermath_api.rb +32 -0
- data/lib/manualpractice_sample_api/apis/api.rb +25 -0
- data/lib/manualpractice_sample_api/apis/base_api.rb +67 -0
- data/lib/manualpractice_sample_api/apis/createsquarerootmath_api.rb +28 -0
- data/lib/manualpractice_sample_api/apis/multipliednumbermath_api.rb +32 -0
- data/lib/manualpractice_sample_api/apis/oauth_authorization_api.rb +87 -0
- data/lib/manualpractice_sample_api/apis/subtractnumbermath_api.rb +34 -0
- data/lib/manualpractice_sample_api/apis/updatenumbermath_api.rb +31 -0
- data/lib/manualpractice_sample_api/client.rb +104 -0
- data/lib/manualpractice_sample_api/configuration.rb +104 -0
- data/lib/manualpractice_sample_api/exceptions/api_exception.rb +21 -0
- data/lib/manualpractice_sample_api/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/manualpractice_sample_api/http/api_response.rb +19 -0
- data/lib/manualpractice_sample_api/http/auth/oauth_2.rb +145 -0
- data/lib/manualpractice_sample_api/http/http_call_back.rb +10 -0
- data/lib/manualpractice_sample_api/http/http_method_enum.rb +10 -0
- data/lib/manualpractice_sample_api/http/http_request.rb +10 -0
- data/lib/manualpractice_sample_api/http/http_response.rb +10 -0
- data/lib/manualpractice_sample_api/logging/configuration/api_logging_configuration.rb +114 -0
- data/lib/manualpractice_sample_api/logging/sdk_logger.rb +17 -0
- data/lib/manualpractice_sample_api/models/addnumbers_response.rb +75 -0
- data/lib/manualpractice_sample_api/models/base_model.rb +110 -0
- data/lib/manualpractice_sample_api/models/complexvalueset.rb +23 -0
- data/lib/manualpractice_sample_api/models/createsquareroot_response.rb +75 -0
- data/lib/manualpractice_sample_api/models/getcode_response.rb +75 -0
- data/lib/manualpractice_sample_api/models/multiplnumbers_response.rb +75 -0
- data/lib/manualpractice_sample_api/models/oauth_provider_error.rb +45 -0
- data/lib/manualpractice_sample_api/models/oauth_scope.rb +23 -0
- data/lib/manualpractice_sample_api/models/oauth_token.rb +96 -0
- data/lib/manualpractice_sample_api/models/subtractnumbers_response.rb +75 -0
- data/lib/manualpractice_sample_api/models/updatenumber_response.rb +75 -0
- data/lib/manualpractice_sample_api/utilities/date_time_helper.rb +11 -0
- data/lib/manualpractice_sample_api/utilities/file_wrapper.rb +28 -0
- data/lib/manualpractice_sample_api.rb +61 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4ff2e9c136f91bc89a757a7d55d684f30ed8f8860212239eba14e944c6bd4352
|
4
|
+
data.tar.gz: c1c751a6211186eb6bb7c689283cb8656bdd6a724a218477cd61a3780dd275ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0162ef85ff368773b236ab49dc7b7bb8bcb7f6b7b85824f6bad073404ea90d4e659e470828d225fc203190ebc392fc8d12e46372d20da2c7566ae0ccae34d301
|
7
|
+
data.tar.gz: 1ba0063bf2bf8594ab687ca654f08c8c48214bc7b3af2327243ee6f7df18f0e5035b3f75afa842d8d14ac222477fcdc03f1e64ed867ab482c8908dd7909dff35
|
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,105 @@
|
|
1
|
+
|
2
|
+
# Getting Started with Manualpractice-SampleAPI
|
3
|
+
|
4
|
+
## Introduction
|
5
|
+
|
6
|
+
Sample API for manual practice.
|
7
|
+
|
8
|
+
## Install the Package
|
9
|
+
|
10
|
+
Install the gem from the command line:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
gem install mannual-calculator -v 1.0.1
|
14
|
+
```
|
15
|
+
|
16
|
+
Or add the gem to your Gemfile and run `bundle`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'mannual-calculator', '1.0.1'
|
20
|
+
```
|
21
|
+
|
22
|
+
For additional gem details, see the [RubyGems page for the mannual-calculator gem](https://rubygems.org/gems/mannual-calculator/versions/1.0.1).
|
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
|
+
| environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
33
|
+
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
34
|
+
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
35
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
|
36
|
+
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
37
|
+
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
38
|
+
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
39
|
+
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
40
|
+
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
41
|
+
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
42
|
+
| logging_configuration | [`LoggingConfiguration`](doc/logging-configuration.md) | The SDK logging configuration for API calls |
|
43
|
+
| authorization_code_auth_credentials | [`AuthorizationCodeAuthCredentials`](__base_path/auth/oauth-2-authorization-code-grant.md) | The credential object for OAuth 2 Authorization Code Grant |
|
44
|
+
|
45
|
+
The API client can be initialized as follows:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
client = ManualpracticeSampleApi::Client.new(
|
49
|
+
authorization_code_auth_credentials: AuthorizationCodeAuthCredentials.new(
|
50
|
+
oauth_client_id: 'OAuthClientId',
|
51
|
+
oauth_client_secret: 'OAuthClientSecret',
|
52
|
+
oauth_redirect_uri: 'OAuthRedirectUri',
|
53
|
+
oauth_scopes: [
|
54
|
+
OauthScope::READ,
|
55
|
+
OauthScope::WRITE
|
56
|
+
]
|
57
|
+
),
|
58
|
+
environment: Environment::PRODUCTION,
|
59
|
+
logging_configuration: LoggingConfiguration.new(
|
60
|
+
log_level: Logger::INFO,
|
61
|
+
request_logging_config: RequestLoggingConfiguration.new(
|
62
|
+
log_body: true
|
63
|
+
),
|
64
|
+
response_logging_config: ResponseLoggingConfiguration.new(
|
65
|
+
log_headers: true
|
66
|
+
)
|
67
|
+
)
|
68
|
+
)
|
69
|
+
```
|
70
|
+
|
71
|
+
## Authorization
|
72
|
+
|
73
|
+
This API uses the following authentication schemes.
|
74
|
+
|
75
|
+
* [`acgauth2 (OAuth 2 Authorization Code Grant)`](__base_path/auth/oauth-2-authorization-code-grant.md)
|
76
|
+
|
77
|
+
## List of APIs
|
78
|
+
|
79
|
+
* [API](doc/controllers/api.md)
|
80
|
+
* [Createsquarerootmath](doc/controllers/createsquarerootmath.md)
|
81
|
+
* [Addnumbermath](doc/controllers/addnumbermath.md)
|
82
|
+
* [Subtractnumbermath](doc/controllers/subtractnumbermath.md)
|
83
|
+
* [Multipliednumbermath](doc/controllers/multipliednumbermath.md)
|
84
|
+
* [Updatenumbermath](doc/controllers/updatenumbermath.md)
|
85
|
+
|
86
|
+
## SDK Infrastructure
|
87
|
+
|
88
|
+
### Configuration
|
89
|
+
|
90
|
+
* [AbstractLogger](doc/abstract-logger.md)
|
91
|
+
* [LoggingConfiguration](doc/logging-configuration.md)
|
92
|
+
* [RequestLoggingConfiguration](doc/request-logging-configuration.md)
|
93
|
+
* [ResponseLoggingConfiguration](doc/response-logging-configuration.md)
|
94
|
+
|
95
|
+
### HTTP
|
96
|
+
|
97
|
+
* [HttpResponse](doc/http-response.md)
|
98
|
+
* [HttpRequest](doc/http-request.md)
|
99
|
+
|
100
|
+
### Utilities
|
101
|
+
|
102
|
+
* [ApiResponse](doc/api-response.md)
|
103
|
+
* [ApiHelper](doc/api-helper.md)
|
104
|
+
* [DateTimeHelper](doc/date-time-helper.md)
|
105
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# AddnumbermathApi
|
8
|
+
class AddnumbermathApi < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @param [Float] num1 Required parameter: TODO: type description here
|
11
|
+
# @param [Float] num2 Required parameter: TODO: type description here
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
13
|
+
def add_numbers(num1,
|
14
|
+
num2)
|
15
|
+
@api_call
|
16
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
17
|
+
'/addnumbers',
|
18
|
+
Server::DEFAULT)
|
19
|
+
.query_param(new_parameter(num1, key: 'num1')
|
20
|
+
.is_required(true))
|
21
|
+
.query_param(new_parameter(num2, key: 'num2')
|
22
|
+
.is_required(true))
|
23
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
24
|
+
.auth(Single.new('acgauth2')))
|
25
|
+
.response(new_response_handler
|
26
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
27
|
+
.deserialize_into(AddnumbersResponse.method(:from_hash))
|
28
|
+
.is_api_response(true))
|
29
|
+
.execute
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# Api
|
8
|
+
class Api < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
11
|
+
def test_endpoint
|
12
|
+
@api_call
|
13
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
14
|
+
'/getcode',
|
15
|
+
Server::DEFAULT)
|
16
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
17
|
+
.auth(Single.new('acgauth2')))
|
18
|
+
.response(new_response_handler
|
19
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
20
|
+
.deserialize_into(GetcodeResponse.method(:from_hash))
|
21
|
+
.is_api_response(true))
|
22
|
+
.execute
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# BaseApi.
|
8
|
+
class BaseApi
|
9
|
+
include CoreLibrary
|
10
|
+
attr_accessor :config, :http_call_back
|
11
|
+
|
12
|
+
def self.user_agent
|
13
|
+
'Ruby-SDK/1.0.1 [OS: {os-info}, Engine: {engine}/{engine-version}]'
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.user_agent_parameters
|
17
|
+
{
|
18
|
+
'{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
|
19
|
+
'{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
|
20
|
+
'{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
GLOBAL_ERRORS = {
|
25
|
+
'default' => ErrorCase.new
|
26
|
+
.error_message('HTTP response not OK.')
|
27
|
+
.exception_type(APIException)
|
28
|
+
}.freeze
|
29
|
+
|
30
|
+
# Initialization constructor.
|
31
|
+
# @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
|
32
|
+
def initialize(global_configuration)
|
33
|
+
@global_configuration = global_configuration
|
34
|
+
@config = @global_configuration.client_configuration
|
35
|
+
@http_call_back = @config.http_callback
|
36
|
+
@api_call = ApiCall.new(@global_configuration)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Creates a new instance of the request builder.
|
40
|
+
# @param [String] http_method The HTTP method to use in the request.
|
41
|
+
# @param [String] path The endpoint path to use in the request.
|
42
|
+
# @param [String] server The server to extract the base uri for the request.
|
43
|
+
# @return [RequestBuilder] The instance of RequestBuilder.
|
44
|
+
def new_request_builder(http_method, path, server)
|
45
|
+
RequestBuilder.new
|
46
|
+
.http_method(http_method)
|
47
|
+
.path(path)
|
48
|
+
.server(server)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates a new instance of the response handler.
|
52
|
+
# @return [ResponseHandler] The instance of ResponseHandler.
|
53
|
+
def new_response_handler
|
54
|
+
ResponseHandler.new
|
55
|
+
end
|
56
|
+
|
57
|
+
# Creates a new instance of the parameter.
|
58
|
+
# @param [String|optional] key The key of the parameter.
|
59
|
+
# @param [Object] value The value of the parameter.
|
60
|
+
# @return [Parameter] The instance of Parameter.
|
61
|
+
def new_parameter(value, key: nil)
|
62
|
+
Parameter.new
|
63
|
+
.key(key)
|
64
|
+
.value(value)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# CreatesquarerootmathApi
|
8
|
+
class CreatesquarerootmathApi < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @param [Float] number Optional parameter: TODO: type description here
|
11
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
12
|
+
def create_square_root(number: nil)
|
13
|
+
@api_call
|
14
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
15
|
+
'/createsquareroot',
|
16
|
+
Server::DEFAULT)
|
17
|
+
.form_param(new_parameter(number, key: 'number'))
|
18
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
19
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
20
|
+
.auth(Single.new('acgauth2')))
|
21
|
+
.response(new_response_handler
|
22
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
23
|
+
.deserialize_into(CreatesquarerootResponse.method(:from_hash))
|
24
|
+
.is_api_response(true))
|
25
|
+
.execute
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# MultipliednumbermathApi
|
8
|
+
class MultipliednumbermathApi < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @param [Float] num1 Required parameter: TODO: type description here
|
11
|
+
# @param [Float] num2 Required parameter: TODO: type description here
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
13
|
+
def multiply_numbers(num1,
|
14
|
+
num2)
|
15
|
+
@api_call
|
16
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
17
|
+
'/multiplnumbers',
|
18
|
+
Server::DEFAULT)
|
19
|
+
.header_param(new_parameter(num1, key: 'num1')
|
20
|
+
.is_required(true))
|
21
|
+
.header_param(new_parameter(num2, key: 'num2')
|
22
|
+
.is_required(true))
|
23
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
24
|
+
.auth(Single.new('acgauth2')))
|
25
|
+
.response(new_response_handler
|
26
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
27
|
+
.deserialize_into(MultiplnumbersResponse.method(:from_hash))
|
28
|
+
.is_api_response(true))
|
29
|
+
.execute
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# OauthAuthorizationApi
|
8
|
+
class OauthAuthorizationApi < BaseApi
|
9
|
+
# Create a new OAuth 2 token.
|
10
|
+
# @param [String] authorization Required parameter: Authorization header in
|
11
|
+
# Basic auth format
|
12
|
+
# @param [String] code Required parameter: Authorization Code
|
13
|
+
# @param [String] redirect_uri Required parameter: Redirect Uri
|
14
|
+
# @param [Hash] _field_parameters Additional optional form parameters are
|
15
|
+
# supported by this endpoint.
|
16
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
17
|
+
def request_token(authorization,
|
18
|
+
code,
|
19
|
+
redirect_uri,
|
20
|
+
_field_parameters: nil)
|
21
|
+
@api_call
|
22
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
23
|
+
'/',
|
24
|
+
Server::DEFAULT)
|
25
|
+
.form_param(new_parameter('authorization_code', key: 'grant_type'))
|
26
|
+
.header_param(new_parameter(authorization, key: 'Authorization')
|
27
|
+
.is_required(true))
|
28
|
+
.form_param(new_parameter(code, key: 'code')
|
29
|
+
.is_required(true))
|
30
|
+
.form_param(new_parameter(redirect_uri, key: 'redirect_uri')
|
31
|
+
.is_required(true))
|
32
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
33
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
34
|
+
.additional_form_params(_field_parameters))
|
35
|
+
.response(new_response_handler
|
36
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
37
|
+
.deserialize_into(OauthToken.method(:from_hash))
|
38
|
+
.is_api_response(true)
|
39
|
+
.local_error('400',
|
40
|
+
'OAuth 2 provider returned an error.',
|
41
|
+
OauthProviderException)
|
42
|
+
.local_error('401',
|
43
|
+
'OAuth 2 provider says client authentication failed.',
|
44
|
+
OauthProviderException))
|
45
|
+
.execute
|
46
|
+
end
|
47
|
+
|
48
|
+
# Obtain a new access token using a refresh token
|
49
|
+
# @param [String] authorization Required parameter: Authorization header in
|
50
|
+
# Basic auth format
|
51
|
+
# @param [String] refresh_token Required parameter: Refresh token
|
52
|
+
# @param [String] scope Optional parameter: Requested scopes as a
|
53
|
+
# space-delimited list.
|
54
|
+
# @param [Hash] _field_parameters Additional optional form parameters are
|
55
|
+
# supported by this endpoint.
|
56
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
57
|
+
def refresh_token(authorization,
|
58
|
+
refresh_token,
|
59
|
+
scope: nil,
|
60
|
+
_field_parameters: nil)
|
61
|
+
@api_call
|
62
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
63
|
+
'/',
|
64
|
+
Server::DEFAULT)
|
65
|
+
.form_param(new_parameter('refresh_token', key: 'grant_type'))
|
66
|
+
.header_param(new_parameter(authorization, key: 'Authorization')
|
67
|
+
.is_required(true))
|
68
|
+
.form_param(new_parameter(refresh_token, key: 'refresh_token')
|
69
|
+
.is_required(true))
|
70
|
+
.form_param(new_parameter(scope, key: 'scope'))
|
71
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
72
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
73
|
+
.additional_form_params(_field_parameters))
|
74
|
+
.response(new_response_handler
|
75
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
76
|
+
.deserialize_into(OauthToken.method(:from_hash))
|
77
|
+
.is_api_response(true)
|
78
|
+
.local_error('400',
|
79
|
+
'OAuth 2 provider returned an error.',
|
80
|
+
OauthProviderException)
|
81
|
+
.local_error('401',
|
82
|
+
'OAuth 2 provider says client authentication failed.',
|
83
|
+
OauthProviderException))
|
84
|
+
.execute
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# SubtractnumbermathApi
|
8
|
+
class SubtractnumbermathApi < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @param [Float] num1 Required parameter: TODO: type description here
|
11
|
+
# @param [Float] num2 Required parameter: TODO: type description here
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
13
|
+
def subtract_numbers(num1,
|
14
|
+
num2)
|
15
|
+
@api_call
|
16
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
17
|
+
'/subtractnumbers/{num1}/{num2}',
|
18
|
+
Server::DEFAULT)
|
19
|
+
.template_param(new_parameter(num1, key: 'num1')
|
20
|
+
.is_required(true)
|
21
|
+
.should_encode(true))
|
22
|
+
.template_param(new_parameter(num2, key: 'num2')
|
23
|
+
.is_required(true)
|
24
|
+
.should_encode(true))
|
25
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
26
|
+
.auth(Single.new('acgauth2')))
|
27
|
+
.response(new_response_handler
|
28
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
29
|
+
.deserialize_into(SubtractnumbersResponse.method(:from_hash))
|
30
|
+
.is_api_response(true))
|
31
|
+
.execute
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# UpdatenumbermathApi
|
8
|
+
class UpdatenumbermathApi < BaseApi
|
9
|
+
# TODO: type endpoint description here
|
10
|
+
# @param [Complexvalueset] body Required parameter: TODO: type description
|
11
|
+
# here
|
12
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
13
|
+
def update_number(body)
|
14
|
+
@api_call
|
15
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
16
|
+
'/updatenumber',
|
17
|
+
Server::DEFAULT)
|
18
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
19
|
+
.body_param(new_parameter(body)
|
20
|
+
.is_required(true))
|
21
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
22
|
+
.body_serializer(proc do |param| param.to_s unless param.nil? end)
|
23
|
+
.auth(Single.new('acgauth2')))
|
24
|
+
.response(new_response_handler
|
25
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
26
|
+
.deserialize_into(UpdatenumberResponse.method(:from_hash))
|
27
|
+
.is_api_response(true))
|
28
|
+
.execute
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# manualpractice_sample_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ManualpracticeSampleApi
|
7
|
+
# manualpractice_sample_api client class.
|
8
|
+
class Client
|
9
|
+
include CoreLibrary
|
10
|
+
attr_reader :config, :auth_managers
|
11
|
+
|
12
|
+
# Returns the configured authentication acgauth2 instance.
|
13
|
+
def acgauth2
|
14
|
+
@auth_managers['acgauth2']
|
15
|
+
end
|
16
|
+
|
17
|
+
# Access to createsquarerootmath controller.
|
18
|
+
# @return [CreatesquarerootmathApi] Returns the controller instance.
|
19
|
+
def createsquarerootmath
|
20
|
+
@createsquarerootmath ||= CreatesquarerootmathApi.new @global_configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
# Access to addnumbermath controller.
|
24
|
+
# @return [AddnumbermathApi] Returns the controller instance.
|
25
|
+
def addnumbermath
|
26
|
+
@addnumbermath ||= AddnumbermathApi.new @global_configuration
|
27
|
+
end
|
28
|
+
|
29
|
+
# Access to subtractnumbermath controller.
|
30
|
+
# @return [SubtractnumbermathApi] Returns the controller instance.
|
31
|
+
def subtractnumbermath
|
32
|
+
@subtractnumbermath ||= SubtractnumbermathApi.new @global_configuration
|
33
|
+
end
|
34
|
+
|
35
|
+
# Access to multipliednumbermath controller.
|
36
|
+
# @return [MultipliednumbermathApi] Returns the controller instance.
|
37
|
+
def multipliednumbermath
|
38
|
+
@multipliednumbermath ||= MultipliednumbermathApi.new @global_configuration
|
39
|
+
end
|
40
|
+
|
41
|
+
# Access to updatenumbermath controller.
|
42
|
+
# @return [UpdatenumbermathApi] Returns the controller instance.
|
43
|
+
def updatenumbermath
|
44
|
+
@updatenumbermath ||= UpdatenumbermathApi.new @global_configuration
|
45
|
+
end
|
46
|
+
|
47
|
+
# Access to client controller.
|
48
|
+
# @return [Api] Returns the controller instance.
|
49
|
+
def client
|
50
|
+
@client ||= Api.new @global_configuration
|
51
|
+
end
|
52
|
+
|
53
|
+
# Access to oauth_authorization controller.
|
54
|
+
# @return [OauthAuthorizationApi] Returns the controller instance.
|
55
|
+
def oauth_authorization
|
56
|
+
@oauth_authorization ||= OauthAuthorizationApi.new @global_configuration
|
57
|
+
end
|
58
|
+
|
59
|
+
def initialize(
|
60
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
61
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
62
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
63
|
+
retry_methods: %i[get put], http_callback: nil,
|
64
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
65
|
+
authorization_code_auth_credentials: nil, config: nil
|
66
|
+
)
|
67
|
+
@config = if config.nil?
|
68
|
+
Configuration.new(
|
69
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
70
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
71
|
+
backoff_factor: backoff_factor,
|
72
|
+
retry_statuses: retry_statuses,
|
73
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
74
|
+
logging_configuration: logging_configuration,
|
75
|
+
environment: environment,
|
76
|
+
authorization_code_auth_credentials: authorization_code_auth_credentials
|
77
|
+
)
|
78
|
+
else
|
79
|
+
config
|
80
|
+
end
|
81
|
+
user_agent_params = BaseApi.user_agent_parameters
|
82
|
+
|
83
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
84
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
85
|
+
.global_errors(BaseApi::GLOBAL_ERRORS)
|
86
|
+
.user_agent(BaseApi.user_agent,
|
87
|
+
agent_parameters: user_agent_params)
|
88
|
+
|
89
|
+
initialize_auth_managers(@global_configuration)
|
90
|
+
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Initializes the auth managers hash used for authenticating API calls.
|
94
|
+
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
95
|
+
def initialize_auth_managers(global_config)
|
96
|
+
@auth_managers = {}
|
97
|
+
http_client_config = global_config.client_configuration
|
98
|
+
%w[acgauth2].each { |auth| @auth_managers[auth] = nil }
|
99
|
+
@auth_managers['acgauth2'] = Oauth2.new(
|
100
|
+
http_client_config.authorization_code_auth_credentials, global_config
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|