sonia-barrera-sdk 3.0.0 → 3.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 +4 -4
- data/README.md +27 -16
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/api_helper.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/client.rb +4 -4
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/configuration.rb +6 -6
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/controllers/base_controller.rb +4 -4
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/controllers/simple_calculator_controller.rb +10 -12
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/exceptions/api_exception.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/http/http_call_back.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/http/http_method_enum.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/http/http_request.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/http/http_response.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/http/proxy_settings.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/models/base_model.rb +15 -3
- data/lib/apimatic_calculator/models/operation_type.rb +29 -0
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/utilities/date_time_helper.rb +3 -3
- data/lib/{apimatic_calculator_zip → apimatic_calculator}/utilities/file_wrapper.rb +3 -3
- data/lib/apimatic_calculator.rb +40 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_simple_calculator_controller.rb +35 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +49 -18
- data/lib/apimatic_calculator_zip/models/operation_type_enum.rb +0 -29
- data/lib/apimatic_calculator_zip.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7587dabc726f74a3ae77ee4ba886b1560f47589e2aaa1fca0e41aa191a405624
|
4
|
+
data.tar.gz: 78d42e316afb5725da49566c50b28fd79349a3d144a7305e8823da767f445133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9115ead210421bf61bfcf71a9154593ec2ec8c79e44637b8ce5c2ec0e6f028e65eec1ef18956ca3601bad786d73657b286d11afffcef7cb9c4a184ec54f003b
|
7
|
+
data.tar.gz: f19891890ffc636bd2c276ba4e57851ef124a6aa20d3e80ac384592d008f4fe233c22a75b37b61f5e4aad8529e254b05bf620af932baa848d585c44a67f92722
|
data/README.md
CHANGED
@@ -1,34 +1,43 @@
|
|
1
1
|
|
2
|
-
# Getting Started with APIMATIC Calculator
|
2
|
+
# Getting Started with APIMATIC Calculator
|
3
3
|
|
4
4
|
## Introduction
|
5
5
|
|
6
|
-
Simple calculator API hosted on APIMATIC
|
6
|
+
Simple calculator API hosted on APIMATIC
|
7
7
|
|
8
8
|
## Install the Package
|
9
9
|
|
10
10
|
Install the gem from the command line:
|
11
11
|
|
12
12
|
```bash
|
13
|
-
gem install sonia-barrera-sdk -v 3.0.
|
13
|
+
gem install sonia-barrera-sdk -v 3.0.1
|
14
14
|
```
|
15
15
|
|
16
16
|
Or add the gem to your Gemfile and run `bundle`:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'sonia-barrera-sdk', '3.0.
|
19
|
+
gem 'sonia-barrera-sdk', '3.0.1'
|
20
20
|
```
|
21
21
|
|
22
|
-
For additional gem details, see the [RubyGems page for the sonia-barrera-sdk gem](https://rubygems.org/gems/sonia-barrera-sdk/versions/3.0.
|
22
|
+
For additional gem details, see the [RubyGems page for the sonia-barrera-sdk gem](https://rubygems.org/gems/sonia-barrera-sdk/versions/3.0.1).
|
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
|
+
```
|
23
31
|
|
24
32
|
## Initialize the API Client
|
25
33
|
|
26
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
34
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/client.md)
|
27
35
|
|
28
36
|
The following parameters are configurable for the API Client:
|
29
37
|
|
30
38
|
| Parameter | Type | Description |
|
31
39
|
| --- | --- | --- |
|
40
|
+
| environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
32
41
|
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
33
42
|
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
34
43
|
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
@@ -38,34 +47,36 @@ The following parameters are configurable for the API Client:
|
|
38
47
|
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
39
48
|
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
40
49
|
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
41
|
-
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
50
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
42
51
|
|
43
52
|
The API client can be initialized as follows:
|
44
53
|
|
45
54
|
```ruby
|
46
|
-
require '
|
47
|
-
include
|
55
|
+
require 'apimatic_calculator'
|
56
|
+
include ApimaticCalculator
|
48
57
|
|
49
|
-
client = Client.new
|
58
|
+
client = Client.new(
|
59
|
+
environment: Environment::PRODUCTION
|
60
|
+
)
|
50
61
|
```
|
51
62
|
|
52
63
|
## List of APIs
|
53
64
|
|
54
|
-
* [Simple Calculator](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
65
|
+
* [Simple Calculator](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/controllers/simple-calculator.md)
|
55
66
|
|
56
67
|
## SDK Infrastructure
|
57
68
|
|
58
69
|
### Configuration
|
59
70
|
|
60
|
-
* [ProxySettings](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
71
|
+
* [ProxySettings](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/proxy-settings.md)
|
61
72
|
|
62
73
|
### HTTP
|
63
74
|
|
64
|
-
* [HttpResponse](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
65
|
-
* [HttpRequest](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
75
|
+
* [HttpResponse](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/http-response.md)
|
76
|
+
* [HttpRequest](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/http-request.md)
|
66
77
|
|
67
78
|
### Utilities
|
68
79
|
|
69
|
-
* [ApiHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
70
|
-
* [DateTimeHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.
|
80
|
+
* [ApiHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/api-helper.md)
|
81
|
+
* [DateTimeHelper](https://www.github.com/ZahraN444/sonia-barrera-ruby-sdk/tree/3.0.1/doc/date-time-helper.md)
|
71
82
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# API utility class
|
8
8
|
class APIHelper < CoreLibrary::ApiHelper
|
9
9
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
7
|
-
#
|
6
|
+
module ApimaticCalculator
|
7
|
+
# apimatic_calculator client class.
|
8
8
|
class Client
|
9
9
|
include CoreLibrary
|
10
10
|
attr_reader :config
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# An enum for SDK environments.
|
8
8
|
class Environment
|
9
9
|
# PRODUCTION: This environment connect to the LIVE calculator API
|
@@ -15,7 +15,7 @@ module ApimaticCalculatorZip
|
|
15
15
|
# An enum for API servers.
|
16
16
|
class Server
|
17
17
|
SERVER = [
|
18
|
-
|
18
|
+
CALCULATOR = 'Calculator'.freeze
|
19
19
|
].freeze
|
20
20
|
end
|
21
21
|
|
@@ -80,7 +80,7 @@ module ApimaticCalculatorZip
|
|
80
80
|
# All the environments the SDK can run in.
|
81
81
|
ENVIRONMENTS = {
|
82
82
|
Environment::PRODUCTION => {
|
83
|
-
Server::
|
83
|
+
Server::CALCULATOR => 'https://examples.apimatic.io/apps/calculator'
|
84
84
|
}
|
85
85
|
}.freeze
|
86
86
|
|
@@ -88,7 +88,7 @@ module ApimaticCalculatorZip
|
|
88
88
|
# @param [Configuration::Server] server The server enum for which the base URI is
|
89
89
|
# required.
|
90
90
|
# @return [String] The base URI.
|
91
|
-
def get_base_uri(server = Server::
|
91
|
+
def get_base_uri(server = Server::CALCULATOR)
|
92
92
|
ENVIRONMENTS[environment][server].clone
|
93
93
|
end
|
94
94
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# BaseController.
|
8
8
|
class BaseController
|
9
9
|
include CoreLibrary
|
10
10
|
attr_accessor :config, :http_call_back
|
11
11
|
|
12
12
|
def self.user_agent
|
13
|
-
'
|
13
|
+
'gcvgffdg'
|
14
14
|
end
|
15
15
|
|
16
16
|
|
data/lib/{apimatic_calculator_zip → apimatic_calculator}/controllers/simple_calculator_controller.rb
RENAMED
@@ -1,28 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# SimpleCalculatorController
|
8
8
|
class SimpleCalculatorController < BaseController
|
9
9
|
# Calculates the expression using the specified operation.
|
10
|
-
# @param [
|
11
|
-
#
|
10
|
+
# @param [OperationType] operation Required parameter: The operator to apply
|
11
|
+
# on the variables
|
12
12
|
# @param [Float] x Required parameter: The LHS value
|
13
13
|
# @param [Float] y Required parameter: The RHS value
|
14
14
|
# @return [Float] Response from the API call.
|
15
|
-
def
|
16
|
-
x,
|
17
|
-
y)
|
15
|
+
def get_calculate(options = {})
|
18
16
|
@api_call
|
19
17
|
.request(new_request_builder(HttpMethodEnum::GET,
|
20
18
|
'/{operation}',
|
21
|
-
Server::
|
22
|
-
.template_param(new_parameter(operation, key: 'operation')
|
19
|
+
Server::CALCULATOR)
|
20
|
+
.template_param(new_parameter(options['operation'], key: 'operation')
|
23
21
|
.should_encode(true))
|
24
|
-
.query_param(new_parameter(x, key: 'x'))
|
25
|
-
.query_param(new_parameter(y, key: 'y')))
|
22
|
+
.query_param(new_parameter(options['x'], key: 'x'))
|
23
|
+
.query_param(new_parameter(options['y'], key: 'y')))
|
26
24
|
.response(new_response_handler
|
27
25
|
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
28
26
|
.deserialize_into(proc do |response| response&.to_f end)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# Class for exceptions when there is a network error, status code error, etc.
|
8
8
|
class APIException < CoreLibrary::ApiException
|
9
9
|
# Provides a human-readable string representation of the object.
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# HttpCallBack allows defining callables for pre and post API calls.
|
8
8
|
class HttpCallBack < CoreLibrary::HttpCallback
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# HTTP Methods Enumeration.
|
8
8
|
class HttpMethodEnum < CoreLibrary::HttpMethod
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# Represents a single Http Request.
|
8
8
|
class HttpRequest < CoreLibrary::HttpRequest
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# Http response received.
|
8
8
|
class HttpResponse < CoreLibrary::HttpResponse
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
##
|
8
8
|
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
9
9
|
# including optional basic authentication.
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# Base model.
|
8
8
|
# rubocop:disable all
|
9
9
|
class BaseModel < CoreLibrary::BaseModel
|
@@ -105,6 +105,18 @@ module ApimaticCalculatorZip
|
|
105
105
|
hash = to_hash
|
106
106
|
hash.to_json(options)
|
107
107
|
end
|
108
|
+
|
109
|
+
def get_additional_properties
|
110
|
+
# Collect all additional properties
|
111
|
+
additional_props = instance_variables.each_with_object({}) do |var, hash|
|
112
|
+
var_name = var.to_s.delete('@').to_sym
|
113
|
+
if !self.class.names.key?(var_name.to_s)
|
114
|
+
hash[var_name] = instance_variable_get(var)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
additional_props
|
119
|
+
end
|
108
120
|
end
|
109
121
|
# rubocop:enable all
|
110
122
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalculator
|
7
|
+
# Possible operators are sum, subtract, multiply, divide
|
8
|
+
class OperationType
|
9
|
+
OPERATION_TYPE = [
|
10
|
+
# Represents the sum operator
|
11
|
+
SUM = 'SUM'.freeze,
|
12
|
+
|
13
|
+
# Represents the subtract operator
|
14
|
+
SUBTRACT = 'SUBTRACT'.freeze,
|
15
|
+
|
16
|
+
# Represents the multiply operator
|
17
|
+
MULTIPLY = 'MULTIPLY'.freeze,
|
18
|
+
|
19
|
+
# Represents the divide operator
|
20
|
+
DIVIDE = 'DIVIDE'.freeze
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
def self.validate(value)
|
24
|
+
return false if value.nil?
|
25
|
+
|
26
|
+
OPERATION_TYPE.include?(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
6
|
require 'date'
|
7
|
-
module
|
7
|
+
module ApimaticCalculator
|
8
8
|
# A utility that supports dateTime conversion to different formats
|
9
9
|
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
10
10
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calculator
|
2
2
|
#
|
3
|
-
# This file was automatically generated by
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalculator
|
7
7
|
# A utility to allow users to set the content-type for files
|
8
8
|
class FileWrapper < CoreLibrary::FileWrapper
|
9
9
|
# The constructor.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
require 'apimatic_core_interfaces'
|
10
|
+
require 'apimatic_core'
|
11
|
+
require 'apimatic_faraday_client_adapter'
|
12
|
+
|
13
|
+
require_relative 'apimatic_calculator/api_helper'
|
14
|
+
require_relative 'apimatic_calculator/client'
|
15
|
+
|
16
|
+
# Utilities
|
17
|
+
require_relative 'apimatic_calculator/utilities/file_wrapper'
|
18
|
+
require_relative 'apimatic_calculator/utilities/date_time_helper'
|
19
|
+
|
20
|
+
# Http
|
21
|
+
require_relative 'apimatic_calculator/http/http_call_back'
|
22
|
+
require_relative 'apimatic_calculator/http/http_method_enum'
|
23
|
+
require_relative 'apimatic_calculator/http/http_request'
|
24
|
+
require_relative 'apimatic_calculator/http/http_response'
|
25
|
+
require_relative 'apimatic_calculator/http/proxy_settings'
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# Models
|
30
|
+
require_relative 'apimatic_calculator/models/base_model'
|
31
|
+
require_relative 'apimatic_calculator/models/operation_type'
|
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'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
require 'minitest/autorun'
|
8
|
+
require 'minitest/hell'
|
9
|
+
require 'minitest/pride'
|
10
|
+
require 'minitest/proveit'
|
11
|
+
require 'apimatic_calculator'
|
12
|
+
require_relative '../http_response_catcher'
|
13
|
+
|
14
|
+
class ControllerTestBase < Minitest::Test
|
15
|
+
parallelize_me!
|
16
|
+
include ApimaticCalculator
|
17
|
+
include CoreLibrary
|
18
|
+
|
19
|
+
# Create configuration and set any test parameters
|
20
|
+
def create_configuration
|
21
|
+
Configuration.new(http_callback: HttpResponseCatcher.new)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Initializes the base test controller
|
25
|
+
def setup_class
|
26
|
+
_config = create_configuration
|
27
|
+
@client = Client.new(config: _config)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class SimpleCalculatorControllerTest < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.simple_calculator
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# Check if multiplication works
|
17
|
+
def test_multiply
|
18
|
+
# Parameters for the API call
|
19
|
+
options = {}
|
20
|
+
options['operation'] = 'MULTIPLY'
|
21
|
+
options['x'] = 4
|
22
|
+
options['y'] = 5
|
23
|
+
|
24
|
+
# Perform the API call through the SDK function
|
25
|
+
result = @controller.get_calculate(options)
|
26
|
+
|
27
|
+
# Test response code
|
28
|
+
assert_equal(200, @response_catcher.response.status_code)
|
29
|
+
|
30
|
+
# Test whether the captured response is as we expected
|
31
|
+
refute_nil(result)
|
32
|
+
assert_equal('20', @response_catcher.response.raw_body)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# apimatic_calculator
|
2
|
+
#
|
3
|
+
# This file was automatically generated for dgfgfdg by
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
class HttpResponseCatcher < ApimaticCalculator::HttpCallBack
|
7
|
+
attr_reader :response
|
8
|
+
|
9
|
+
def on_before_request(request)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Catching the response
|
13
|
+
def on_after_response(response)
|
14
|
+
@response = response
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonia-barrera-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zahra naseem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.1.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 5.24.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 5.24.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-proveit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
55
83
|
description: Vel dolores harum ip
|
56
84
|
email:
|
57
85
|
- kawanyqum@mailinator.com
|
@@ -61,22 +89,25 @@ extra_rdoc_files: []
|
|
61
89
|
files:
|
62
90
|
- LICENSE
|
63
91
|
- README.md
|
64
|
-
- lib/
|
65
|
-
- lib/
|
66
|
-
- lib/
|
67
|
-
- lib/
|
68
|
-
- lib/
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/
|
77
|
-
- lib/
|
78
|
-
- lib/
|
79
|
-
- lib/
|
92
|
+
- lib/apimatic_calculator.rb
|
93
|
+
- lib/apimatic_calculator/api_helper.rb
|
94
|
+
- lib/apimatic_calculator/client.rb
|
95
|
+
- lib/apimatic_calculator/configuration.rb
|
96
|
+
- lib/apimatic_calculator/controllers/base_controller.rb
|
97
|
+
- lib/apimatic_calculator/controllers/simple_calculator_controller.rb
|
98
|
+
- lib/apimatic_calculator/exceptions/api_exception.rb
|
99
|
+
- lib/apimatic_calculator/http/http_call_back.rb
|
100
|
+
- lib/apimatic_calculator/http/http_method_enum.rb
|
101
|
+
- lib/apimatic_calculator/http/http_request.rb
|
102
|
+
- lib/apimatic_calculator/http/http_response.rb
|
103
|
+
- lib/apimatic_calculator/http/proxy_settings.rb
|
104
|
+
- lib/apimatic_calculator/models/base_model.rb
|
105
|
+
- lib/apimatic_calculator/models/operation_type.rb
|
106
|
+
- lib/apimatic_calculator/utilities/date_time_helper.rb
|
107
|
+
- lib/apimatic_calculator/utilities/file_wrapper.rb
|
108
|
+
- test/controllers/controller_test_base.rb
|
109
|
+
- test/controllers/test_simple_calculator_controller.rb
|
110
|
+
- test/http_response_catcher.rb
|
80
111
|
homepage: https://www.qocuqy.cc
|
81
112
|
licenses:
|
82
113
|
- MIT
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# apimatic_calculator_zip
|
2
|
-
#
|
3
|
-
# This file was automatically generated by
|
4
|
-
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module ApimaticCalculatorZip
|
7
|
-
# Possible operators are sum, subtract, multiply, divide
|
8
|
-
class OperationTypeEnum
|
9
|
-
OPERATION_TYPE_ENUM = [
|
10
|
-
# TODO: Write general description for SUM
|
11
|
-
SUM = 'SUM'.freeze,
|
12
|
-
|
13
|
-
# TODO: Write general description for SUBTRACT
|
14
|
-
SUBTRACT = 'SUBTRACT'.freeze,
|
15
|
-
|
16
|
-
# TODO: Write general description for MULTIPLY
|
17
|
-
MULTIPLY = 'MULTIPLY'.freeze,
|
18
|
-
|
19
|
-
# TODO: Write general description for DIVIDE
|
20
|
-
DIVIDE = 'DIVIDE'.freeze
|
21
|
-
].freeze
|
22
|
-
|
23
|
-
def self.validate(value)
|
24
|
-
return false if value.nil?
|
25
|
-
|
26
|
-
OPERATION_TYPE_ENUM.include?(value)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# apimatic_calculator_zip
|
2
|
-
#
|
3
|
-
# This file was automatically generated by
|
4
|
-
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
require 'date'
|
7
|
-
require 'json'
|
8
|
-
|
9
|
-
require 'apimatic_core_interfaces'
|
10
|
-
require 'apimatic_core'
|
11
|
-
require 'apimatic_faraday_client_adapter'
|
12
|
-
|
13
|
-
require_relative 'apimatic_calculator_zip/api_helper'
|
14
|
-
require_relative 'apimatic_calculator_zip/client'
|
15
|
-
|
16
|
-
# Utilities
|
17
|
-
require_relative 'apimatic_calculator_zip/utilities/file_wrapper'
|
18
|
-
require_relative 'apimatic_calculator_zip/utilities/date_time_helper'
|
19
|
-
|
20
|
-
# Http
|
21
|
-
require_relative 'apimatic_calculator_zip/http/http_call_back'
|
22
|
-
require_relative 'apimatic_calculator_zip/http/http_method_enum'
|
23
|
-
require_relative 'apimatic_calculator_zip/http/http_request'
|
24
|
-
require_relative 'apimatic_calculator_zip/http/http_response'
|
25
|
-
require_relative 'apimatic_calculator_zip/http/proxy_settings'
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
# Models
|
30
|
-
require_relative 'apimatic_calculator_zip/models/base_model'
|
31
|
-
require_relative 'apimatic_calculator_zip/models/operation_type_enum'
|
32
|
-
|
33
|
-
# Exceptions
|
34
|
-
require_relative 'apimatic_calculator_zip/exceptions/api_exception'
|
35
|
-
|
36
|
-
require_relative 'apimatic_calculator_zip/configuration'
|
37
|
-
|
38
|
-
# Controllers
|
39
|
-
require_relative 'apimatic_calculator_zip/controllers/base_controller'
|
40
|
-
require_relative 'apimatic_calculator_zip/controllers/' \
|
41
|
-
'simple_calculator_controller'
|