automated-package-publishing-sdk 1.0.29 → 1.0.30
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 +4 -4
- data/README.md +105 -105
- data/lib/apimatic_calculator/api_helper.rb +10 -10
- data/lib/apimatic_calculator/client.rb +50 -50
- data/lib/apimatic_calculator/configuration.rb +111 -111
- data/lib/apimatic_calculator/controllers/base_controller.rb +53 -53
- data/lib/apimatic_calculator/controllers/simple_calculator_controller.rb +33 -33
- data/lib/apimatic_calculator/exceptions/api_exception.rb +21 -21
- data/lib/apimatic_calculator/http/http_call_back.rb +10 -10
- data/lib/apimatic_calculator/http/http_method_enum.rb +10 -10
- data/lib/apimatic_calculator/http/http_request.rb +10 -10
- data/lib/apimatic_calculator/http/http_response.rb +10 -10
- data/lib/apimatic_calculator/http/proxy_settings.rb +5 -5
- data/lib/apimatic_calculator/models/base_model.rb +110 -110
- data/lib/apimatic_calculator/models/operation_type_enum.rb +40 -40
- data/lib/apimatic_calculator/utilities/date_time_helper.rb +11 -11
- data/lib/apimatic_calculator/utilities/file_wrapper.rb +17 -17
- data/lib/apimatic_calculator.rb +40 -40
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2d7779a6328d1dafc0ffaa88d04ef204105927a90949095ed63332221ebdfcf
|
|
4
|
+
data.tar.gz: 2ac7526e6180f60691e17524203a15f1893b3ab23a16c938ede1ed924cb6bbb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8a4b62036e4aca7c5744c148711aa38a6756c36b259ebc3113ba2f4c4f5d77b915b8c2cfcdd3e9d2a9095b6851147ecfcbae61cdd3bd8cc2e422830e95ba42d
|
|
7
|
+
data.tar.gz: e83ad8023316518c60d95df6d83aba0bf8914acc63f8331d82cc1f0bcf7d3783b8ade1e41f0aba9806c32efdc74000c9c6e6b96aa5a59e6abf1f87cb3394d6a4
|
data/README.md
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
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
|
-
```bash
|
|
13
|
-
gem install automated-package-publishing-sdk -v 1.0.
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Or add the gem to your Gemfile and run `bundle`:
|
|
17
|
-
|
|
18
|
-
```ruby
|
|
19
|
-
gem 'automated-package-publishing-sdk', '1.0.
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
For additional gem details, see the [RubyGems page for the automated-package-publishing-sdk gem](https://rubygems.org/gems/automated-package-publishing-sdk/versions/1.0.
|
|
23
|
-
|
|
24
|
-
## IRB Console Usage
|
|
25
|
-
|
|
26
|
-
You can explore the SDK interactively using IRB in two ways
|
|
27
|
-
|
|
28
|
-
### 1. Use IRB with Installed Gem
|
|
29
|
-
|
|
30
|
-
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
irb
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Now you can load the SDK in the IRB
|
|
37
|
-
|
|
38
|
-
```ruby
|
|
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
|
+
```bash
|
|
13
|
+
gem install automated-package-publishing-sdk -v 1.0.30
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or add the gem to your Gemfile and run `bundle`:
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
gem 'automated-package-publishing-sdk', '1.0.30'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For additional gem details, see the [RubyGems page for the automated-package-publishing-sdk gem](https://rubygems.org/gems/automated-package-publishing-sdk/versions/1.0.30).
|
|
23
|
+
|
|
24
|
+
## IRB Console Usage
|
|
25
|
+
|
|
26
|
+
You can explore the SDK interactively using IRB in two ways
|
|
27
|
+
|
|
28
|
+
### 1. Use IRB with Installed Gem
|
|
29
|
+
|
|
30
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
irb
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Now you can load the SDK in the IRB
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
39
|
require 'apimatic_calculator'
|
|
40
|
-
include ApimaticCalculator
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 2. Use IRB within SDK
|
|
44
|
-
|
|
45
|
-
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
cd path/to/apimatic_calculator
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Now you can start the preconfigured irb console by running the following command
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
ruby bin/console
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**_Note:_** This automatically loads the SDK from lib/
|
|
58
|
-
|
|
59
|
-
## Initialize the API Client
|
|
60
|
-
|
|
61
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
62
|
-
|
|
63
|
-
The following parameters are configurable for the API Client:
|
|
64
|
-
|
|
65
|
-
| Parameter | Type | Description |
|
|
66
|
-
| --- | --- | --- |
|
|
67
|
-
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
68
|
-
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
69
|
-
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
70
|
-
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
71
|
-
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
|
72
|
-
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
|
73
|
-
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
74
|
-
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
75
|
-
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
76
|
-
| proxy_settings | [`ProxySettings`](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
77
|
-
|
|
78
|
-
The API client can be initialized as follows:
|
|
79
|
-
|
|
80
|
-
### Code-Based Client Initialization
|
|
81
|
-
|
|
82
|
-
```ruby
|
|
40
|
+
include ApimaticCalculator
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Use IRB within SDK
|
|
44
|
+
|
|
45
|
+
Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
cd path/to/apimatic_calculator
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can start the preconfigured irb console by running the following command
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
ruby bin/console
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**_Note:_** This automatically loads the SDK from lib/
|
|
58
|
+
|
|
59
|
+
## Initialize the API Client
|
|
60
|
+
|
|
61
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/client.md)
|
|
62
|
+
|
|
63
|
+
The following parameters are configurable for the API Client:
|
|
64
|
+
|
|
65
|
+
| Parameter | Type | Description |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
68
|
+
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
69
|
+
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
70
|
+
| max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
|
71
|
+
| retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
|
72
|
+
| backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
|
73
|
+
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
74
|
+
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
75
|
+
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
76
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
77
|
+
|
|
78
|
+
The API client can be initialized as follows:
|
|
79
|
+
|
|
80
|
+
### Code-Based Client Initialization
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
83
|
require 'apimatic_calculator'
|
|
84
84
|
include ApimaticCalculator
|
|
85
85
|
|
|
86
|
-
client = Client.new
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Environment-Based Client Initialization
|
|
90
|
-
|
|
91
|
-
```ruby
|
|
86
|
+
client = Client.new
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Environment-Based Client Initialization
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
92
|
require 'apimatic_calculator'
|
|
93
93
|
include ApimaticCalculator
|
|
94
94
|
|
|
95
95
|
# Create client from environment
|
|
96
|
-
client = Client.from_env
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
See the [`Environment-Based Client Initialization`](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
100
|
-
|
|
101
|
-
## List of APIs
|
|
102
|
-
|
|
103
|
-
* [Simple Calculator](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
104
|
-
|
|
105
|
-
## SDK Infrastructure
|
|
106
|
-
|
|
96
|
+
client = Client.from_env
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/environment-based-client-initialization.md) section for details.
|
|
100
|
+
|
|
101
|
+
## List of APIs
|
|
102
|
+
|
|
103
|
+
* [Simple Calculator](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/controllers/simple-calculator.md)
|
|
104
|
+
|
|
105
|
+
## SDK Infrastructure
|
|
106
|
+
|
|
107
107
|
### Configuration
|
|
108
108
|
|
|
109
|
-
* [ProxySettings](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
110
|
-
* [Environment-Based Client Initialization](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
109
|
+
* [ProxySettings](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/proxy-settings.md)
|
|
110
|
+
* [Environment-Based Client Initialization](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/environment-based-client-initialization.md)
|
|
111
111
|
|
|
112
112
|
### HTTP
|
|
113
113
|
|
|
114
|
-
* [HttpResponse](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
115
|
-
* [HttpRequest](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
114
|
+
* [HttpResponse](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/http-response.md)
|
|
115
|
+
* [HttpRequest](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/http-request.md)
|
|
116
116
|
|
|
117
117
|
### Utilities
|
|
118
118
|
|
|
119
|
-
* [ApiHelper](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
120
|
-
* [DateTimeHelper](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.
|
|
121
|
-
|
|
119
|
+
* [ApiHelper](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/api-helper.md)
|
|
120
|
+
* [DateTimeHelper](https://www.github.com/WasifMatic/automated-package-publishing-ruby-sdk/tree/1.0.30/doc/date-time-helper.md)
|
|
121
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# apimatic_calculator
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
-
|
|
6
|
-
module ApimaticCalculator
|
|
7
|
-
# API utility class
|
|
8
|
-
class APIHelper < CoreLibrary::ApiHelper
|
|
9
|
-
end
|
|
10
|
-
end
|
|
1
|
+
# apimatic_calculator
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ApimaticCalculator
|
|
7
|
+
# API utility class
|
|
8
|
+
class APIHelper < CoreLibrary::ApiHelper
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# apimatic_calculator
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
-
|
|
6
|
-
module ApimaticCalculator
|
|
7
|
-
# apimatic_calculator client class.
|
|
8
|
-
class Client
|
|
9
|
-
include CoreLibrary
|
|
10
|
-
attr_reader :config
|
|
11
|
-
|
|
12
|
-
def user_agent_detail
|
|
13
|
-
config.user_agent_detail
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Access to simple_calculator controller.
|
|
17
|
-
# @return [SimpleCalculatorController] Returns the controller instance.
|
|
18
|
-
def simple_calculator
|
|
19
|
-
@simple_calculator ||= SimpleCalculatorController.new @global_configuration
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def initialize(
|
|
23
|
-
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
24
|
-
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
25
|
-
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
26
|
-
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
27
|
-
environment: Environment::PRODUCTION, config: nil
|
|
28
|
-
)
|
|
29
|
-
@config = if config.nil?
|
|
30
|
-
Configuration.new(connection: connection, adapter: adapter,
|
|
31
|
-
timeout: timeout, max_retries: max_retries,
|
|
32
|
-
retry_interval: retry_interval,
|
|
33
|
-
backoff_factor: backoff_factor,
|
|
34
|
-
retry_statuses: retry_statuses,
|
|
35
|
-
retry_methods: retry_methods,
|
|
36
|
-
http_callback: http_callback,
|
|
37
|
-
proxy_settings: proxy_settings,
|
|
38
|
-
environment: environment)
|
|
39
|
-
else
|
|
40
|
-
config
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
44
|
-
.base_uri_executor(@config.method(:get_base_uri))
|
|
45
|
-
.global_errors(BaseController::GLOBAL_ERRORS)
|
|
46
|
-
.user_agent(BaseController.user_agent)
|
|
47
|
-
end
|
|
1
|
+
# apimatic_calculator
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ApimaticCalculator
|
|
7
|
+
# apimatic_calculator client class.
|
|
8
|
+
class Client
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_reader :config
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Access to simple_calculator controller.
|
|
17
|
+
# @return [SimpleCalculatorController] Returns the controller instance.
|
|
18
|
+
def simple_calculator
|
|
19
|
+
@simple_calculator ||= SimpleCalculatorController.new @global_configuration
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize(
|
|
23
|
+
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
24
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
25
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
26
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
27
|
+
environment: Environment::PRODUCTION, config: nil
|
|
28
|
+
)
|
|
29
|
+
@config = if config.nil?
|
|
30
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
31
|
+
timeout: timeout, max_retries: max_retries,
|
|
32
|
+
retry_interval: retry_interval,
|
|
33
|
+
backoff_factor: backoff_factor,
|
|
34
|
+
retry_statuses: retry_statuses,
|
|
35
|
+
retry_methods: retry_methods,
|
|
36
|
+
http_callback: http_callback,
|
|
37
|
+
proxy_settings: proxy_settings,
|
|
38
|
+
environment: environment)
|
|
39
|
+
else
|
|
40
|
+
config
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
44
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
|
45
|
+
.global_errors(BaseController::GLOBAL_ERRORS)
|
|
46
|
+
.user_agent(BaseController.user_agent)
|
|
47
|
+
end
|
|
48
48
|
|
|
49
49
|
# Creates a client directly from environment variables.
|
|
50
50
|
def self.from_env(**overrides)
|
|
51
51
|
default_config = Configuration.build_default_config_from_env
|
|
52
52
|
new_config = default_config.clone_with(**overrides)
|
|
53
53
|
new(config: new_config)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
# apimatic_calculator
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
# v3.0 ( https://www.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
|
-
|
|
14
|
-
# Converts a string or symbol into a valid Environment constant.
|
|
15
|
-
def self.from_value(value, default_value = PRODUCTION)
|
|
16
|
-
return default_value if value.nil?
|
|
17
|
-
|
|
18
|
-
default_value
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# An enum for API servers.
|
|
23
|
-
class Server
|
|
24
|
-
SERVER = [
|
|
25
|
-
DEFAULT = 'default'.freeze
|
|
26
|
-
].freeze
|
|
27
|
-
|
|
28
|
-
# Converts a string or symbol into a valid Server constant.
|
|
29
|
-
def self.from_value(value, default_value = DEFAULT)
|
|
30
|
-
return default_value if value.nil?
|
|
31
|
-
|
|
32
|
-
default_value
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# All configuration including auth info and base URI for the API access
|
|
37
|
-
# are configured in this class.
|
|
38
|
-
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
39
|
-
# The attribute readers for properties.
|
|
40
|
-
attr_reader :environment
|
|
41
|
-
|
|
42
|
-
class << self
|
|
43
|
-
attr_reader :environments
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def initialize(
|
|
47
|
-
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
48
|
-
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
49
|
-
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
50
|
-
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
51
|
-
environment: Environment::PRODUCTION
|
|
52
|
-
)
|
|
53
|
-
super connection: connection, adapter: adapter, timeout: timeout,
|
|
54
|
-
max_retries: max_retries, retry_interval: retry_interval,
|
|
55
|
-
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
56
|
-
retry_methods: retry_methods, http_callback: http_callback,
|
|
57
|
-
proxy_settings: proxy_settings
|
|
58
|
-
|
|
59
|
-
# Current API environment
|
|
60
|
-
@environment = String(environment)
|
|
61
|
-
|
|
62
|
-
# The Http Client to use for making requests.
|
|
63
|
-
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
67
|
-
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
68
|
-
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
69
|
-
proxy_settings: nil, environment: nil)
|
|
70
|
-
connection ||= self.connection
|
|
71
|
-
adapter ||= self.adapter
|
|
72
|
-
timeout ||= self.timeout
|
|
73
|
-
max_retries ||= self.max_retries
|
|
74
|
-
retry_interval ||= self.retry_interval
|
|
75
|
-
backoff_factor ||= self.backoff_factor
|
|
76
|
-
retry_statuses ||= self.retry_statuses
|
|
77
|
-
retry_methods ||= self.retry_methods
|
|
78
|
-
http_callback ||= self.http_callback
|
|
79
|
-
proxy_settings ||= self.proxy_settings
|
|
80
|
-
environment ||= self.environment
|
|
81
|
-
|
|
82
|
-
Configuration.new(connection: connection, adapter: adapter,
|
|
83
|
-
timeout: timeout, max_retries: max_retries,
|
|
84
|
-
retry_interval: retry_interval,
|
|
85
|
-
backoff_factor: backoff_factor,
|
|
86
|
-
retry_statuses: retry_statuses,
|
|
87
|
-
retry_methods: retry_methods,
|
|
88
|
-
http_callback: http_callback,
|
|
89
|
-
proxy_settings: proxy_settings,
|
|
90
|
-
environment: environment)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# All the environments the SDK can run in.
|
|
95
|
-
ENVIRONMENTS = {
|
|
96
|
-
Environment::PRODUCTION => {
|
|
97
|
-
Server::DEFAULT => 'https://examples.apimatic.io/apps/calculator'
|
|
98
|
-
}
|
|
99
|
-
}.freeze
|
|
100
|
-
|
|
101
|
-
# Generates the appropriate base URI for the environment and the server.
|
|
102
|
-
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
103
|
-
# required.
|
|
104
|
-
# @return [String] The base URI.
|
|
105
|
-
def get_base_uri(server = Server::DEFAULT)
|
|
106
|
-
ENVIRONMENTS[environment][server].clone
|
|
107
|
-
end
|
|
108
|
-
|
|
1
|
+
# apimatic_calculator
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.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
|
+
|
|
14
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
15
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
16
|
+
return default_value if value.nil?
|
|
17
|
+
|
|
18
|
+
default_value
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# An enum for API servers.
|
|
23
|
+
class Server
|
|
24
|
+
SERVER = [
|
|
25
|
+
DEFAULT = 'default'.freeze
|
|
26
|
+
].freeze
|
|
27
|
+
|
|
28
|
+
# Converts a string or symbol into a valid Server constant.
|
|
29
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
30
|
+
return default_value if value.nil?
|
|
31
|
+
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# All configuration including auth info and base URI for the API access
|
|
37
|
+
# are configured in this class.
|
|
38
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
39
|
+
# The attribute readers for properties.
|
|
40
|
+
attr_reader :environment
|
|
41
|
+
|
|
42
|
+
class << self
|
|
43
|
+
attr_reader :environments
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def initialize(
|
|
47
|
+
connection: nil, adapter: :net_http_persistent, timeout: 60,
|
|
48
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
49
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
50
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
51
|
+
environment: Environment::PRODUCTION
|
|
52
|
+
)
|
|
53
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
54
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
55
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
56
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
57
|
+
proxy_settings: proxy_settings
|
|
58
|
+
|
|
59
|
+
# Current API environment
|
|
60
|
+
@environment = String(environment)
|
|
61
|
+
|
|
62
|
+
# The Http Client to use for making requests.
|
|
63
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
67
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
68
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
69
|
+
proxy_settings: nil, environment: nil)
|
|
70
|
+
connection ||= self.connection
|
|
71
|
+
adapter ||= self.adapter
|
|
72
|
+
timeout ||= self.timeout
|
|
73
|
+
max_retries ||= self.max_retries
|
|
74
|
+
retry_interval ||= self.retry_interval
|
|
75
|
+
backoff_factor ||= self.backoff_factor
|
|
76
|
+
retry_statuses ||= self.retry_statuses
|
|
77
|
+
retry_methods ||= self.retry_methods
|
|
78
|
+
http_callback ||= self.http_callback
|
|
79
|
+
proxy_settings ||= self.proxy_settings
|
|
80
|
+
environment ||= self.environment
|
|
81
|
+
|
|
82
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
83
|
+
timeout: timeout, max_retries: max_retries,
|
|
84
|
+
retry_interval: retry_interval,
|
|
85
|
+
backoff_factor: backoff_factor,
|
|
86
|
+
retry_statuses: retry_statuses,
|
|
87
|
+
retry_methods: retry_methods,
|
|
88
|
+
http_callback: http_callback,
|
|
89
|
+
proxy_settings: proxy_settings,
|
|
90
|
+
environment: environment)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# All the environments the SDK can run in.
|
|
95
|
+
ENVIRONMENTS = {
|
|
96
|
+
Environment::PRODUCTION => {
|
|
97
|
+
Server::DEFAULT => 'https://examples.apimatic.io/apps/calculator'
|
|
98
|
+
}
|
|
99
|
+
}.freeze
|
|
100
|
+
|
|
101
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
102
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
103
|
+
# required.
|
|
104
|
+
# @return [String] The base URI.
|
|
105
|
+
def get_base_uri(server = Server::DEFAULT)
|
|
106
|
+
ENVIRONMENTS[environment][server].clone
|
|
107
|
+
end
|
|
108
|
+
|
|
109
109
|
# Builds a Configuration instance using environment variables.
|
|
110
110
|
def self.build_default_config_from_env
|
|
111
111
|
# === Core environment ===
|
|
@@ -141,6 +141,6 @@ module ApimaticCalculator
|
|
|
141
141
|
retry_methods: retry_methods,
|
|
142
142
|
proxy_settings: proxy_settings
|
|
143
143
|
)
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|