syed-subtain 9.6.1 → 9.63.5
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/LICENSE +1 -1
- data/README.md +12 -18
- data/lib/{apimatic_calculator → apimatic_calcu}/api_helper.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/client.rb +3 -3
- data/lib/{apimatic_calculator → apimatic_calcu}/configuration.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/controllers/base_controller.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/controllers/simple_calculator_controller.rb +2 -2
- data/lib/apimatic_calcu/exceptions/api_exception.rb +10 -0
- data/lib/{apimatic_calculator → apimatic_calcu}/http/http_call_back.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/http/http_method_enum.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/http/http_request.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/http/http_response.rb +2 -2
- data/lib/apimatic_calcu/models/base_model.rb +62 -0
- data/lib/{apimatic_calculator → apimatic_calcu}/models/operation_type_enum.rb +2 -2
- data/lib/{apimatic_calculator → apimatic_calcu}/utilities/date_time_helper.rb +2 -2
- data/lib/apimatic_calcu/utilities/file_wrapper.rb +16 -0
- data/lib/apimatic_calcu.rb +39 -0
- metadata +20 -20
- data/lib/apimatic_calculator/exceptions/api_exception.rb +0 -21
- data/lib/apimatic_calculator/models/base_model.rb +0 -110
- data/lib/apimatic_calculator/utilities/file_wrapper.rb +0 -28
- data/lib/apimatic_calculator.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5e25de8d0bc0e3d4d889df83910e32533afd992ada3db01b3633fb2f28eb8b0
|
4
|
+
data.tar.gz: 4a970ecec311159e7e6722bfcf251f1e9e90b087f2c46c02951bed3d2994de9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a8e51969222fce55d13f707aa25e05ae5b4f92a5d79a3db7bf8dc2a8504cff95ab027f8ad6658f09898426b7044cf85d8fe89f2eb9f5be76725d17e91ee35fd
|
7
|
+
data.tar.gz: 823197847734ef206ae74df756af7aee89d6ec1f552e77c859c4a943aced5027d89297ea4b3149dfed2eca48d8a8a90dde10ed78ceaa14213f0fa111c125bc94
|
data/LICENSE
CHANGED
@@ -3,7 +3,7 @@ License:
|
|
3
3
|
The MIT License (MIT)
|
4
4
|
http://opensource.org/licenses/MIT
|
5
5
|
|
6
|
-
Copyright (c) 2014 -
|
6
|
+
Copyright (c) 2014 - 2024 APIMATIC Limited
|
7
7
|
|
8
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
9
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
# Getting Started with Apimatic
|
2
|
+
# Getting Started with Apimatic Calcu
|
3
3
|
|
4
4
|
## Introduction
|
5
5
|
|
@@ -9,21 +9,21 @@ Simple calculator API hosted on APIMATIC
|
|
9
9
|
|
10
10
|
Install the gem from the command line:
|
11
11
|
|
12
|
-
```
|
13
|
-
gem install syed-subtain -v 9.
|
12
|
+
```ruby
|
13
|
+
gem install syed-subtain -v 9.63.5
|
14
14
|
```
|
15
15
|
|
16
16
|
Or add the gem to your Gemfile and run `bundle`:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'syed-subtain', '9.
|
19
|
+
gem 'syed-subtain', '9.63.5'
|
20
20
|
```
|
21
21
|
|
22
|
-
For additional gem details, see the [RubyGems page for the syed-subtain gem](https://rubygems.org/gems/syed-subtain/versions/9.
|
22
|
+
For additional gem details, see the [RubyGems page for the syed-subtain gem](https://rubygems.org/gems/syed-subtain/versions/9.63.5).
|
23
23
|
|
24
24
|
## Initialize the API Client
|
25
25
|
|
26
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/
|
26
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/syed-subtain/new-ruby-repo/tree/9.63.5/doc/client.md)
|
27
27
|
|
28
28
|
The following parameters are configurable for the API Client:
|
29
29
|
|
@@ -43,24 +43,18 @@ The following parameters are configurable for the API Client:
|
|
43
43
|
The API client can be initialized as follows:
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
client =
|
46
|
+
client = ApimaticCalcu::Client.new(
|
47
47
|
environment: Environment::PRODUCTION
|
48
48
|
)
|
49
49
|
```
|
50
50
|
|
51
51
|
## List of APIs
|
52
52
|
|
53
|
-
* [Simple Calculator](https://www.github.com/
|
53
|
+
* [Simple Calculator](https://www.github.com/syed-subtain/new-ruby-repo/tree/9.63.5/doc/controllers/simple-calculator.md)
|
54
54
|
|
55
|
-
##
|
55
|
+
## Classes Documentation
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
* [
|
60
|
-
* [HttpRequest](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/http-request.md)
|
61
|
-
|
62
|
-
### Utilities
|
63
|
-
|
64
|
-
* [ApiHelper](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/api-helper.md)
|
65
|
-
* [DateTimeHelper](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/date-time-helper.md)
|
57
|
+
* [Utility Classes](https://www.github.com/syed-subtain/new-ruby-repo/tree/9.63.5/doc/utility-classes.md)
|
58
|
+
* [HttpResponse](https://www.github.com/syed-subtain/new-ruby-repo/tree/9.63.5/doc/http-response.md)
|
59
|
+
* [HttpRequest](https://www.github.com/syed-subtain/new-ruby-repo/tree/9.63.5/doc/http-request.md)
|
66
60
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
7
|
-
#
|
6
|
+
module ApimaticCalcu
|
7
|
+
# apimatic_calcu client class.
|
8
8
|
class Client
|
9
9
|
include CoreLibrary
|
10
10
|
attr_reader :config
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# An enum for SDK environments.
|
8
8
|
class Environment
|
9
9
|
# PRODUCTION: This environment connect to the LIVE calculator API
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# SimpleCalculatorController
|
8
8
|
class SimpleCalculatorController < BaseController
|
9
9
|
# Calculates the expression using the specified operation.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# apimatic_calcu
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalcu
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < CoreLibrary::ApiException
|
9
|
+
end
|
10
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
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_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# HTTP Methods Enumeration.
|
8
8
|
class HttpMethodEnum < CoreLibrary::HttpMethod
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# Represents a single Http Request.
|
8
8
|
class HttpRequest < CoreLibrary::HttpRequest
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# Http response received.
|
8
8
|
class HttpResponse < CoreLibrary::HttpResponse
|
9
9
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# apimatic_calcu
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalcu
|
7
|
+
# Base model.
|
8
|
+
class BaseModel < CoreLibrary::BaseModel
|
9
|
+
# Returns a Hash representation of the current object.
|
10
|
+
def to_hash
|
11
|
+
# validating the model being serialized
|
12
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
13
|
+
|
14
|
+
hash = {}
|
15
|
+
instance_variables.each do |name|
|
16
|
+
value = instance_variable_get(name)
|
17
|
+
name = name[1..]
|
18
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
19
|
+
optional_fields = self.class.optionals
|
20
|
+
nullable_fields = self.class.nullables
|
21
|
+
if value.nil?
|
22
|
+
next unless nullable_fields.include?(name)
|
23
|
+
|
24
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
25
|
+
raise ArgumentError,
|
26
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
hash[key] = nil
|
31
|
+
unless value.nil?
|
32
|
+
if respond_to?("to_custom_#{name}")
|
33
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
34
|
+
params = [hash, key]
|
35
|
+
hash[key] = send("to_custom_#{name}", *params)
|
36
|
+
else
|
37
|
+
hash[key] = send("to_custom_#{name}")
|
38
|
+
end
|
39
|
+
elsif respond_to?("to_union_type_#{name}")
|
40
|
+
hash[key] = send("to_union_type_#{name}")
|
41
|
+
elsif value.instance_of? Array
|
42
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
43
|
+
elsif value.instance_of? Hash
|
44
|
+
hash[key] = {}
|
45
|
+
value.each do |k, v|
|
46
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
47
|
+
end
|
48
|
+
else
|
49
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
hash
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns a JSON representation of the curent object.
|
57
|
+
def to_json(options = {})
|
58
|
+
hash = to_hash
|
59
|
+
hash.to_json(options)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
-
module
|
6
|
+
module ApimaticCalcu
|
7
7
|
# Possible operators are sum, subtract, multiply, divide
|
8
8
|
class OperationTypeEnum
|
9
9
|
OPERATION_TYPE_ENUM = [
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# apimatic_calcu
|
2
2
|
#
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
6
|
require 'date'
|
7
|
-
module
|
7
|
+
module ApimaticCalcu
|
8
8
|
# A utility that supports dateTime conversion to different formats
|
9
9
|
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
10
10
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# apimatic_calcu
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ApimaticCalcu
|
7
|
+
# A utility to allow users to set the content-type for files
|
8
|
+
class FileWrapper < CoreLibrary::FileWrapper
|
9
|
+
# The constructor.
|
10
|
+
# @param [File] file The file to be sent in the request.
|
11
|
+
# @param [string] content_type The content type of the provided file.
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# apimatic_calcu
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://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_calcu/api_helper'
|
14
|
+
require_relative 'apimatic_calcu/client'
|
15
|
+
|
16
|
+
# Utilities
|
17
|
+
require_relative 'apimatic_calcu/utilities/file_wrapper'
|
18
|
+
require_relative 'apimatic_calcu/utilities/date_time_helper'
|
19
|
+
|
20
|
+
# Http
|
21
|
+
require_relative 'apimatic_calcu/http/http_call_back'
|
22
|
+
require_relative 'apimatic_calcu/http/http_method_enum'
|
23
|
+
require_relative 'apimatic_calcu/http/http_request'
|
24
|
+
require_relative 'apimatic_calcu/http/http_response'
|
25
|
+
|
26
|
+
# Logger
|
27
|
+
|
28
|
+
# Models
|
29
|
+
require_relative 'apimatic_calcu/models/base_model'
|
30
|
+
require_relative 'apimatic_calcu/models/operation_type_enum'
|
31
|
+
|
32
|
+
# Exceptions
|
33
|
+
require_relative 'apimatic_calcu/exceptions/api_exception'
|
34
|
+
|
35
|
+
require_relative 'apimatic_calcu/configuration'
|
36
|
+
|
37
|
+
# Controllers
|
38
|
+
require_relative 'apimatic_calcu/controllers/base_controller'
|
39
|
+
require_relative 'apimatic_calcu/controllers/simple_calculator_controller'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syed-subtain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.63.5
|
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: 2024-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.
|
33
|
+
version: 0.3.9
|
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.9
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: apimatic_faraday_client_adapter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,22 +60,22 @@ extra_rdoc_files: []
|
|
60
60
|
files:
|
61
61
|
- LICENSE
|
62
62
|
- README.md
|
63
|
-
- lib/
|
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
|
-
homepage:
|
63
|
+
- lib/apimatic_calcu.rb
|
64
|
+
- lib/apimatic_calcu/api_helper.rb
|
65
|
+
- lib/apimatic_calcu/client.rb
|
66
|
+
- lib/apimatic_calcu/configuration.rb
|
67
|
+
- lib/apimatic_calcu/controllers/base_controller.rb
|
68
|
+
- lib/apimatic_calcu/controllers/simple_calculator_controller.rb
|
69
|
+
- lib/apimatic_calcu/exceptions/api_exception.rb
|
70
|
+
- lib/apimatic_calcu/http/http_call_back.rb
|
71
|
+
- lib/apimatic_calcu/http/http_method_enum.rb
|
72
|
+
- lib/apimatic_calcu/http/http_request.rb
|
73
|
+
- lib/apimatic_calcu/http/http_response.rb
|
74
|
+
- lib/apimatic_calcu/models/base_model.rb
|
75
|
+
- lib/apimatic_calcu/models/operation_type_enum.rb
|
76
|
+
- lib/apimatic_calcu/utilities/date_time_helper.rb
|
77
|
+
- lib/apimatic_calcu/utilities/file_wrapper.rb
|
78
|
+
homepage: ''
|
79
79
|
licenses:
|
80
80
|
- MIT
|
81
81
|
metadata: {}
|
@@ -1,21 +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
|
-
# Provides a human-readable string representation of the object.
|
10
|
-
def to_s
|
11
|
-
class_name = self.class.name.split('::').last
|
12
|
-
"<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
|
13
|
-
end
|
14
|
-
|
15
|
-
# Provides a debugging-friendly string with detailed object information.
|
16
|
-
def inspect
|
17
|
-
class_name = self.class.name.split('::').last
|
18
|
-
"<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,110 +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
|
-
# Base model.
|
8
|
-
# rubocop:disable all
|
9
|
-
class BaseModel < CoreLibrary::BaseModel
|
10
|
-
# Returns a Hash representation of the current object.
|
11
|
-
def to_hash
|
12
|
-
# validating the model being serialized
|
13
|
-
self.class.validate(self) if self.class.respond_to?(:validate)
|
14
|
-
|
15
|
-
hash = {}
|
16
|
-
instance_variables.each do |name|
|
17
|
-
value = instance_variable_get(name)
|
18
|
-
name = name[1..]
|
19
|
-
if name == 'additional_properties'
|
20
|
-
additional_properties = process_additional_properties(value, self.class.names)
|
21
|
-
hash.merge!(additional_properties)
|
22
|
-
else
|
23
|
-
key = self.class.names.key?(name) ? self.class.names[name] : name
|
24
|
-
optional_fields = self.class.optionals
|
25
|
-
nullable_fields = self.class.nullables
|
26
|
-
if value.nil?
|
27
|
-
next unless nullable_fields.include?(name)
|
28
|
-
|
29
|
-
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
30
|
-
raise ArgumentError,
|
31
|
-
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
hash[key] = nil
|
36
|
-
unless value.nil?
|
37
|
-
if respond_to?("to_custom_#{name}")
|
38
|
-
if (value.instance_of? Array) || (value.instance_of? Hash)
|
39
|
-
params = [hash, key]
|
40
|
-
hash[key] = send("to_custom_#{name}", *params)
|
41
|
-
else
|
42
|
-
hash[key] = send("to_custom_#{name}")
|
43
|
-
end
|
44
|
-
elsif respond_to?("to_union_type_#{name}")
|
45
|
-
hash[key] = send("to_union_type_#{name}")
|
46
|
-
elsif value.instance_of? Array
|
47
|
-
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
48
|
-
elsif value.instance_of? Hash
|
49
|
-
hash[key] = {}
|
50
|
-
value.each do |k, v|
|
51
|
-
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
52
|
-
end
|
53
|
-
else
|
54
|
-
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
hash
|
60
|
-
end
|
61
|
-
|
62
|
-
# Processes additional properties, ensuring no conflicts with existing properties.
|
63
|
-
def process_additional_properties(additional_properties, existing_prop_names)
|
64
|
-
hash = {}
|
65
|
-
additional_properties.each do |name, value|
|
66
|
-
check_for_conflict(name, existing_prop_names)
|
67
|
-
|
68
|
-
hash[name] = if value.is_a?(Array)
|
69
|
-
process_array(value)
|
70
|
-
elsif value.is_a?(Hash)
|
71
|
-
process_hash(value)
|
72
|
-
else
|
73
|
-
process_basic_value(value)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
hash
|
77
|
-
end
|
78
|
-
|
79
|
-
# Checks if an additional property conflicts with a model's existing property.
|
80
|
-
def check_for_conflict(name, existing_prop_names)
|
81
|
-
return unless existing_prop_names.key?(name)
|
82
|
-
|
83
|
-
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
84
|
-
end
|
85
|
-
|
86
|
-
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
87
|
-
def process_array(value)
|
88
|
-
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
89
|
-
end
|
90
|
-
|
91
|
-
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
92
|
-
def process_hash(value)
|
93
|
-
value.transform_values do |v|
|
94
|
-
v.is_a?(BaseModel) ? v.to_hash : v
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# Processes a basic value (non-array, non-hash).
|
99
|
-
def process_basic_value(value)
|
100
|
-
value.is_a?(BaseModel) ? value.to_hash : value
|
101
|
-
end
|
102
|
-
|
103
|
-
# Returns a JSON representation of the curent object.
|
104
|
-
def to_json(options = {})
|
105
|
-
hash = to_hash
|
106
|
-
hash.to_json(options)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
# rubocop:enable all
|
110
|
-
end
|
@@ -1,28 +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
|
-
# A utility to allow users to set the content-type for files
|
8
|
-
class FileWrapper < CoreLibrary::FileWrapper
|
9
|
-
# The constructor.
|
10
|
-
# @param [File] file The file to be sent in the request.
|
11
|
-
# @param [string] content_type The content type of the provided file.
|
12
|
-
def initialize(file, content_type: 'application/octet-stream')
|
13
|
-
super
|
14
|
-
end
|
15
|
-
|
16
|
-
# Provides a human-readable string representation of the object.
|
17
|
-
def to_s
|
18
|
-
class_name = self.class.name.split('::').last
|
19
|
-
"<#{class_name} file: #{@file}, content_type: #{@content_type}>"
|
20
|
-
end
|
21
|
-
|
22
|
-
# Provides a debugging-friendly string with detailed object information.
|
23
|
-
def to_inspect
|
24
|
-
class_name = self.class.name.split('::').last
|
25
|
-
"<#{class_name} file: #{@file.inspect}, content_type: #{@content_type.inspect}>"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/apimatic_calculator.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# apimatic_calculator
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require 'date'
|
7
|
-
require 'json'
|
8
|
-
|
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
|
-
|
26
|
-
# Logger
|
27
|
-
|
28
|
-
# Models
|
29
|
-
require_relative 'apimatic_calculator/models/base_model'
|
30
|
-
require_relative 'apimatic_calculator/models/operation_type_enum'
|
31
|
-
|
32
|
-
# Exceptions
|
33
|
-
require_relative 'apimatic_calculator/exceptions/api_exception'
|
34
|
-
|
35
|
-
require_relative 'apimatic_calculator/configuration'
|
36
|
-
|
37
|
-
# Controllers
|
38
|
-
require_relative 'apimatic_calculator/controllers/base_controller'
|
39
|
-
require_relative 'apimatic_calculator/controllers/simple_calculator_controller'
|