subtain_pack 1.0.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/arch +1 -0
- data/bin/ash +1 -0
- data/bin/base64 +1 -0
- data/bin/bbconfig +1 -0
- data/bin/busybox +0 -0
- data/bin/cat +1 -0
- data/bin/chattr +1 -0
- data/bin/chgrp +1 -0
- data/bin/chmod +1 -0
- data/bin/chown +1 -0
- data/bin/cp +1 -0
- data/bin/date +1 -0
- data/bin/dd +1 -0
- data/bin/df +1 -0
- data/bin/dmesg +1 -0
- data/bin/dnsdomainname +1 -0
- data/bin/dumpkmap +1 -0
- data/bin/echo +1 -0
- data/bin/ed +1 -0
- data/bin/egrep +1 -0
- data/bin/false +1 -0
- data/bin/fatattr +1 -0
- data/bin/fdflush +1 -0
- data/bin/fgrep +1 -0
- data/bin/fsync +1 -0
- data/bin/getopt +1 -0
- data/bin/grep +1 -0
- data/bin/gunzip +1 -0
- data/bin/gzip +1 -0
- data/bin/hostname +1 -0
- data/bin/ionice +1 -0
- data/bin/iostat +1 -0
- data/bin/ipcalc +1 -0
- data/bin/kbd_mode +1 -0
- data/bin/kill +1 -0
- data/bin/link +1 -0
- data/bin/linux32 +1 -0
- data/bin/linux64 +1 -0
- data/bin/ln +1 -0
- data/bin/login +1 -0
- data/bin/ls +1 -0
- data/bin/lsattr +1 -0
- data/bin/lzop +1 -0
- data/bin/makemime +1 -0
- data/bin/mkdir +1 -0
- data/bin/mknod +1 -0
- data/bin/mktemp +1 -0
- data/bin/more +1 -0
- data/bin/mount +1 -0
- data/bin/mountpoint +1 -0
- data/bin/mpstat +1 -0
- data/bin/mv +1 -0
- data/bin/netstat +1 -0
- data/bin/nice +1 -0
- data/bin/pidof +0 -0
- data/bin/ping +1 -0
- data/bin/ping6 +1 -0
- data/bin/pipe_progress +1 -0
- data/bin/printenv +1 -0
- data/bin/ps +0 -0
- data/bin/pwait +0 -0
- data/bin/pwd +1 -0
- data/bin/reformime +1 -0
- data/bin/rev +1 -0
- data/bin/rm +1 -0
- data/bin/rmdir +1 -0
- data/bin/run-parts +1 -0
- data/bin/sed +1 -0
- data/bin/setpriv +1 -0
- data/bin/setserial +1 -0
- data/bin/sh +1 -0
- data/bin/slabtop +0 -0
- data/bin/sleep +1 -0
- data/bin/stat +1 -0
- data/bin/stty +1 -0
- data/bin/su +1 -0
- data/bin/sync +1 -0
- data/bin/tar +1 -0
- data/bin/tload +0 -0
- data/bin/touch +1 -0
- data/bin/true +1 -0
- data/bin/umount +1 -0
- data/bin/uname +1 -0
- data/bin/usleep +1 -0
- data/bin/vmstat +0 -0
- data/bin/w +0 -0
- data/bin/watch +0 -0
- data/bin/zcat +1 -0
- data/lib/apk/db/installed +3582 -0
- data/lib/apk/db/lock +0 -0
- data/lib/apk/db/scripts.tar +0 -0
- data/lib/apk/db/triggers +2 -0
- data/lib/ld-musl-x86_64.so.1 +0 -0
- data/lib/libapk.so.3.12.0 +0 -0
- data/lib/libc.musl-x86_64.so.1 +1 -0
- data/lib/libcrypto.so.1.1 +0 -0
- data/lib/libprocps.so.8 +1 -0
- data/lib/libprocps.so.8.0.3 +0 -0
- data/lib/libssl.so.1.1 +0 -0
- data/lib/libz.so +1 -0
- data/lib/libz.so.1 +1 -0
- data/lib/libz.so.1.2.12 +0 -0
- data/lib/sysctl.d/00-alpine.conf +40 -0
- metadata +119 -30
- data/LICENSE +0 -28
- data/README.md +0 -68
- data/lib/apimatic_calculator/api_helper.rb +0 -10
- data/lib/apimatic_calculator/client.rb +0 -44
- data/lib/apimatic_calculator/configuration.rb +0 -92
- data/lib/apimatic_calculator/controllers/base_controller.rb +0 -66
- data/lib/apimatic_calculator/controllers/simple_calculator_controller.rb +0 -31
- data/lib/apimatic_calculator/exceptions/api_exception.rb +0 -10
- data/lib/apimatic_calculator/http/http_call_back.rb +0 -10
- data/lib/apimatic_calculator/http/http_method_enum.rb +0 -10
- data/lib/apimatic_calculator/http/http_request.rb +0 -10
- data/lib/apimatic_calculator/http/http_response.rb +0 -10
- data/lib/apimatic_calculator/models/base_model.rb +0 -62
- data/lib/apimatic_calculator/models/operation_type_enum.rb +0 -29
- data/lib/apimatic_calculator/utilities/date_time_helper.rb +0 -11
- data/lib/apimatic_calculator/utilities/file_wrapper.rb +0 -16
- data/lib/apimatic_calculator.rb +0 -39
- data/test/controllers/controller_test_base.rb +0 -29
- data/test/controllers/test_simple_calculator_controller.rb +0 -35
- data/test/http_response_catcher.rb +0 -19
data/lib/apk/db/lock
ADDED
File without changes
|
Binary file
|
data/lib/apk/db/triggers
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
lib/ld-musl-x86_64.so.1
|
Binary file
|
data/lib/libprocps.so.8
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/libprocps.so.8.0.3
|
Binary file
|
data/lib/libssl.so.1.1
ADDED
Binary file
|
data/lib/libz.so
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/libz.so.1.2.12
|
data/lib/libz.so.1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/libz.so.1.2.12
|
data/lib/libz.so.1.2.12
ADDED
Binary file
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Prevents SYN DOS attacks. Applies to ipv6 as well, despite name.
|
2
|
+
net.ipv4.tcp_syncookies = 1
|
3
|
+
|
4
|
+
# Prevents ip spoofing.
|
5
|
+
net.ipv4.conf.default.rp_filter = 1
|
6
|
+
net.ipv4.conf.all.rp_filter = 1
|
7
|
+
|
8
|
+
# Only groups within this id range can use ping.
|
9
|
+
net.ipv4.ping_group_range=999 59999
|
10
|
+
|
11
|
+
# Redirects can potentially be used to maliciously alter hosts
|
12
|
+
# routing tables.
|
13
|
+
net.ipv4.conf.all.accept_redirects = 0
|
14
|
+
net.ipv4.conf.all.secure_redirects = 1
|
15
|
+
net.ipv6.conf.all.accept_redirects = 0
|
16
|
+
|
17
|
+
# The source routing feature includes some known vulnerabilities.
|
18
|
+
net.ipv4.conf.all.accept_source_route = 0
|
19
|
+
net.ipv6.conf.all.accept_source_route = 0
|
20
|
+
|
21
|
+
# See RFC 1337
|
22
|
+
net.ipv4.tcp_rfc1337 = 1
|
23
|
+
|
24
|
+
## Enable IPv6 Privacy Extensions (see RFC4941 and RFC3041)
|
25
|
+
net.ipv6.conf.default.use_tempaddr = 2
|
26
|
+
net.ipv6.conf.all.use_tempaddr = 2
|
27
|
+
|
28
|
+
# Restarts computer after 120 seconds after kernel panic
|
29
|
+
kernel.panic = 120
|
30
|
+
|
31
|
+
# Users should not be able to create soft or hard links to files
|
32
|
+
# which they do not own. This mitigates several privilege
|
33
|
+
# escalation vulnerabilities.
|
34
|
+
fs.protected_hardlinks = 1
|
35
|
+
fs.protected_symlinks = 1
|
36
|
+
|
37
|
+
# Disable unprivileged use of the bpf(2) syscall.
|
38
|
+
# Allowing unprivileged use of the bpf(2) syscall may allow a
|
39
|
+
# malicious user to compromise the machine.
|
40
|
+
kernel.unprivileged_bpf_disabled = 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subtain_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syed subtain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -16,56 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2.
|
19
|
+
version: 0.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.
|
26
|
+
version: 0.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: apimatic_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.3.
|
40
|
+
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: apimatic_faraday_client_adapter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.
|
61
|
+
version: '5.14'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 5.14.1
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - "~>"
|
67
70
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.
|
71
|
+
version: '5.14'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 5.14.1
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: minitest-proveit
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,26 +92,109 @@ executables: []
|
|
86
92
|
extensions: []
|
87
93
|
extra_rdoc_files: []
|
88
94
|
files:
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
95
|
+
- bin/arch
|
96
|
+
- bin/ash
|
97
|
+
- bin/base64
|
98
|
+
- bin/bbconfig
|
99
|
+
- bin/busybox
|
100
|
+
- bin/cat
|
101
|
+
- bin/chattr
|
102
|
+
- bin/chgrp
|
103
|
+
- bin/chmod
|
104
|
+
- bin/chown
|
105
|
+
- bin/cp
|
106
|
+
- bin/date
|
107
|
+
- bin/dd
|
108
|
+
- bin/df
|
109
|
+
- bin/dmesg
|
110
|
+
- bin/dnsdomainname
|
111
|
+
- bin/dumpkmap
|
112
|
+
- bin/echo
|
113
|
+
- bin/ed
|
114
|
+
- bin/egrep
|
115
|
+
- bin/false
|
116
|
+
- bin/fatattr
|
117
|
+
- bin/fdflush
|
118
|
+
- bin/fgrep
|
119
|
+
- bin/fsync
|
120
|
+
- bin/getopt
|
121
|
+
- bin/grep
|
122
|
+
- bin/gunzip
|
123
|
+
- bin/gzip
|
124
|
+
- bin/hostname
|
125
|
+
- bin/ionice
|
126
|
+
- bin/iostat
|
127
|
+
- bin/ipcalc
|
128
|
+
- bin/kbd_mode
|
129
|
+
- bin/kill
|
130
|
+
- bin/link
|
131
|
+
- bin/linux32
|
132
|
+
- bin/linux64
|
133
|
+
- bin/ln
|
134
|
+
- bin/login
|
135
|
+
- bin/ls
|
136
|
+
- bin/lsattr
|
137
|
+
- bin/lzop
|
138
|
+
- bin/makemime
|
139
|
+
- bin/mkdir
|
140
|
+
- bin/mknod
|
141
|
+
- bin/mktemp
|
142
|
+
- bin/more
|
143
|
+
- bin/mount
|
144
|
+
- bin/mountpoint
|
145
|
+
- bin/mpstat
|
146
|
+
- bin/mv
|
147
|
+
- bin/netstat
|
148
|
+
- bin/nice
|
149
|
+
- bin/pidof
|
150
|
+
- bin/ping
|
151
|
+
- bin/ping6
|
152
|
+
- bin/pipe_progress
|
153
|
+
- bin/printenv
|
154
|
+
- bin/ps
|
155
|
+
- bin/pwait
|
156
|
+
- bin/pwd
|
157
|
+
- bin/reformime
|
158
|
+
- bin/rev
|
159
|
+
- bin/rm
|
160
|
+
- bin/rmdir
|
161
|
+
- bin/run-parts
|
162
|
+
- bin/sed
|
163
|
+
- bin/setpriv
|
164
|
+
- bin/setserial
|
165
|
+
- bin/sh
|
166
|
+
- bin/slabtop
|
167
|
+
- bin/sleep
|
168
|
+
- bin/stat
|
169
|
+
- bin/stty
|
170
|
+
- bin/su
|
171
|
+
- bin/sync
|
172
|
+
- bin/tar
|
173
|
+
- bin/tload
|
174
|
+
- bin/touch
|
175
|
+
- bin/true
|
176
|
+
- bin/umount
|
177
|
+
- bin/uname
|
178
|
+
- bin/usleep
|
179
|
+
- bin/vmstat
|
180
|
+
- bin/w
|
181
|
+
- bin/watch
|
182
|
+
- bin/zcat
|
183
|
+
- lib/apk/db/installed
|
184
|
+
- lib/apk/db/lock
|
185
|
+
- lib/apk/db/scripts.tar
|
186
|
+
- lib/apk/db/triggers
|
187
|
+
- lib/ld-musl-x86_64.so.1
|
188
|
+
- lib/libapk.so.3.12.0
|
189
|
+
- lib/libc.musl-x86_64.so.1
|
190
|
+
- lib/libcrypto.so.1.1
|
191
|
+
- lib/libprocps.so.8
|
192
|
+
- lib/libprocps.so.8.0.3
|
193
|
+
- lib/libssl.so.1.1
|
194
|
+
- lib/libz.so
|
195
|
+
- lib/libz.so.1
|
196
|
+
- lib/libz.so.1.2.12
|
197
|
+
- lib/sysctl.d/00-alpine.conf
|
109
198
|
homepage: ''
|
110
199
|
licenses:
|
111
200
|
- MIT
|
data/LICENSE
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
License:
|
2
|
-
========
|
3
|
-
The MIT License (MIT)
|
4
|
-
http://opensource.org/licenses/MIT
|
5
|
-
|
6
|
-
Copyright (c) 2014 - 2024 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
DELETED
@@ -1,68 +0,0 @@
|
|
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 subtain_pack -v 1.0.0
|
14
|
-
```
|
15
|
-
|
16
|
-
Or add the gem to your Gemfile and run `bundle`:
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
gem 'subtain_pack', '1.0.0'
|
20
|
-
```
|
21
|
-
|
22
|
-
For additional gem details, see the [RubyGems page for the subtain_pack gem](https://rubygems.org/gems/subtain_pack/versions/1.0.0).
|
23
|
-
|
24
|
-
## Test the SDK
|
25
|
-
|
26
|
-
To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
|
27
|
-
|
28
|
-
```
|
29
|
-
rake
|
30
|
-
```
|
31
|
-
|
32
|
-
## Initialize the API Client
|
33
|
-
|
34
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/Syed-Subtain/apimatic-ruby-test/tree/1.0.0/doc/client.md)
|
35
|
-
|
36
|
-
The following parameters are configurable for the API Client:
|
37
|
-
|
38
|
-
| Parameter | Type | Description |
|
39
|
-
| --- | --- | --- |
|
40
|
-
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
41
|
-
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
42
|
-
| `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
43
|
-
| `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
44
|
-
| `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
|
45
|
-
| `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
|
46
|
-
| `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
|
47
|
-
| `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
48
|
-
| `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
49
|
-
| `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
50
|
-
|
51
|
-
The API client can be initialized as follows:
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
client = ApimaticCalculator::Client.new(
|
55
|
-
environment: Environment::PRODUCTION
|
56
|
-
)
|
57
|
-
```
|
58
|
-
|
59
|
-
## List of APIs
|
60
|
-
|
61
|
-
* [Simple Calculator](https://www.github.com/Syed-Subtain/apimatic-ruby-test/tree/1.0.0/doc/controllers/simple-calculator.md)
|
62
|
-
|
63
|
-
## Classes Documentation
|
64
|
-
|
65
|
-
* [Utility Classes](https://www.github.com/Syed-Subtain/apimatic-ruby-test/tree/1.0.0/doc/utility-classes.md)
|
66
|
-
* [HttpResponse](https://www.github.com/Syed-Subtain/apimatic-ruby-test/tree/1.0.0/doc/http-response.md)
|
67
|
-
* [HttpRequest](https://www.github.com/Syed-Subtain/apimatic-ruby-test/tree/1.0.0/doc/http-request.md)
|
68
|
-
|
@@ -1,44 +0,0 @@
|
|
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
|
-
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,
|
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
|
-
environment: environment)
|
34
|
-
else
|
35
|
-
config
|
36
|
-
end
|
37
|
-
|
38
|
-
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
39
|
-
.base_uri_executor(@config.method(:get_base_uri))
|
40
|
-
.global_errors(BaseController::GLOBAL_ERRORS)
|
41
|
-
.user_agent(BaseController.user_agent)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,92 +0,0 @@
|
|
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
|
-
CALCULATOR = 'Calculator'.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,
|
37
|
-
environment: Environment::PRODUCTION
|
38
|
-
)
|
39
|
-
|
40
|
-
super connection: connection, adapter: adapter, timeout: timeout,
|
41
|
-
max_retries: max_retries, retry_interval: retry_interval,
|
42
|
-
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
43
|
-
retry_methods: retry_methods, http_callback: http_callback
|
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
|
-
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
|
-
environment ||= self.environment
|
66
|
-
|
67
|
-
Configuration.new(connection: connection, adapter: adapter,
|
68
|
-
timeout: timeout, max_retries: max_retries,
|
69
|
-
retry_interval: retry_interval,
|
70
|
-
backoff_factor: backoff_factor,
|
71
|
-
retry_statuses: retry_statuses,
|
72
|
-
retry_methods: retry_methods,
|
73
|
-
http_callback: http_callback, environment: environment)
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
# All the environments the SDK can run in.
|
78
|
-
ENVIRONMENTS = {
|
79
|
-
Environment::PRODUCTION => {
|
80
|
-
Server::CALCULATOR => 'https://examples.apimatic.io/apps/calculator'
|
81
|
-
}
|
82
|
-
}.freeze
|
83
|
-
|
84
|
-
# Generates the appropriate base URI for the environment and the server.
|
85
|
-
# @param [Configuration::Server] server The server enum for which the base URI is
|
86
|
-
# required.
|
87
|
-
# @return [String] The base URI.
|
88
|
-
def get_base_uri(server = Server::CALCULATOR)
|
89
|
-
ENVIRONMENTS[environment][server].clone
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,66 +0,0 @@
|
|
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
|
-
include CoreLibrary
|
10
|
-
attr_accessor :config, :http_call_back
|
11
|
-
|
12
|
-
def self.user_agent
|
13
|
-
'APIMATIC 3.0'
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
GLOBAL_ERRORS = {
|
18
|
-
'default' => ErrorCase.new
|
19
|
-
.error_message('HTTP response not OK.')
|
20
|
-
.exception_type(APIException)
|
21
|
-
}.freeze
|
22
|
-
|
23
|
-
# Initialization constructor.
|
24
|
-
# @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
|
25
|
-
def initialize(global_configuration)
|
26
|
-
@global_configuration = global_configuration
|
27
|
-
@config = @global_configuration.client_configuration
|
28
|
-
@http_call_back = @config.http_callback
|
29
|
-
@api_call = ApiCall.new(@global_configuration)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Creates a new builder for the Api Call instance.
|
33
|
-
# @return [ApiCall] The instance of ApiCall.
|
34
|
-
def new_api_call_builder
|
35
|
-
@api_call.new_builder
|
36
|
-
end
|
37
|
-
|
38
|
-
# Creates a new instance of the request builder.
|
39
|
-
# @param [String] http_method The HTTP method to use in the request.
|
40
|
-
# @param [String] path The endpoint path to use in the request.
|
41
|
-
# @param [String] server The server to extract the base uri for the request.
|
42
|
-
# @return [RequestBuilder] The instance of RequestBuilder.
|
43
|
-
def new_request_builder(http_method, path, server)
|
44
|
-
RequestBuilder.new
|
45
|
-
.http_method(http_method)
|
46
|
-
.path(path)
|
47
|
-
.server(server)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Creates a new instance of the response handler.
|
51
|
-
# @return [ResponseHandler] The instance of ResponseHandler.
|
52
|
-
def new_response_handler
|
53
|
-
ResponseHandler.new
|
54
|
-
end
|
55
|
-
|
56
|
-
# Creates a new instance of the parameter.
|
57
|
-
# @param [String|optional] key The key of the parameter.
|
58
|
-
# @param [Object] value The value of the parameter.
|
59
|
-
# @return [Parameter] The instance of Parameter.
|
60
|
-
def new_parameter(value, key: nil)
|
61
|
-
Parameter.new
|
62
|
-
.key(key)
|
63
|
-
.value(value)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,31 +0,0 @@
|
|
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 get_calculate(options = {})
|
16
|
-
new_api_call_builder
|
17
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
18
|
-
'/{operation}',
|
19
|
-
Server::CALCULATOR)
|
20
|
-
.template_param(new_parameter(options['operation'], key: 'operation')
|
21
|
-
.should_encode(true))
|
22
|
-
.query_param(new_parameter(options['x'], key: 'x'))
|
23
|
-
.query_param(new_parameter(options['y'], key: 'y')))
|
24
|
-
.response(new_response_handler
|
25
|
-
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
26
|
-
.deserialize_into(proc do |response| response.to_f end)
|
27
|
-
.is_primitive_response(true))
|
28
|
-
.execute
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,10 +0,0 @@
|
|
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
|
@@ -1,10 +0,0 @@
|
|
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
|