syed-subtain 1.11.14 → 9.6.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/LICENSE +1 -1
- data/README.md +16 -10
- data/lib/apimatic_calculator/exceptions/api_exception.rb +11 -0
- data/lib/apimatic_calculator/models/base_model.rb +76 -28
- data/lib/apimatic_calculator/utilities/file_wrapper.rb +14 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd9b92d7f84c5cb682fc25579b10477688f36f12df9f47f27d49fe1439e6008d
|
4
|
+
data.tar.gz: bc1f1224ff7124ffa76124692122aee1ffe629ad46c11aee8d5e302d3148c154
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7124b3c78484340295496cbb4d88fe2483b70a5ff1058f15fdabe613bd6b9aaf67785feff986ce27ee2e200215ba28e8f8d93867a1ce13cb74703d38090ef4c9
|
7
|
+
data.tar.gz: abc2390a398cf3e2dcab0042d4bf0d766c8855c93af2471011d016398565b5431482ec77a6df2e0a5087b521d4a35b605940b4f9777638e1eed1a9578675a1b9
|
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 - 2025 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
@@ -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
|
12
|
+
```bash
|
13
|
+
gem install syed-subtain -v 9.6.1
|
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', '
|
19
|
+
gem 'syed-subtain', '9.6.1'
|
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/
|
22
|
+
For additional gem details, see the [RubyGems page for the syed-subtain gem](https://rubygems.org/gems/syed-subtain/versions/9.6.1).
|
23
23
|
|
24
24
|
## Initialize the API Client
|
25
25
|
|
26
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/
|
26
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/client.md)
|
27
27
|
|
28
28
|
The following parameters are configurable for the API Client:
|
29
29
|
|
@@ -50,11 +50,17 @@ client = ApimaticCalculator::Client.new(
|
|
50
50
|
|
51
51
|
## List of APIs
|
52
52
|
|
53
|
-
* [Simple Calculator](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/
|
53
|
+
* [Simple Calculator](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/controllers/simple-calculator.md)
|
54
54
|
|
55
|
-
##
|
55
|
+
## Additional Documentation
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
* [
|
57
|
+
### Wrappers
|
58
|
+
|
59
|
+
* [HttpResponse](https://www.github.com/Syed-Subtain/new-ruby-repo/tree/9.6.1/doc/http-response.md)
|
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)
|
60
66
|
|
@@ -6,5 +6,16 @@
|
|
6
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
|
+
# 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
|
9
20
|
end
|
10
21
|
end
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
module ApimaticCalculator
|
7
7
|
# Base model.
|
8
|
+
# rubocop:disable all
|
8
9
|
class BaseModel < CoreLibrary::BaseModel
|
9
10
|
# Returns a Hash representation of the current object.
|
10
11
|
def to_hash
|
@@ -15,48 +16,95 @@ module ApimaticCalculator
|
|
15
16
|
instance_variables.each do |name|
|
16
17
|
value = instance_variable_get(name)
|
17
18
|
name = name[1..]
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
27
33
|
end
|
28
|
-
end
|
29
34
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
36
53
|
else
|
37
|
-
hash[key] =
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
38
55
|
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
56
|
end
|
51
57
|
end
|
52
58
|
end
|
53
59
|
hash
|
54
60
|
end
|
55
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
|
+
|
56
103
|
# Returns a JSON representation of the curent object.
|
57
104
|
def to_json(options = {})
|
58
105
|
hash = to_hash
|
59
106
|
hash.to_json(options)
|
60
107
|
end
|
61
108
|
end
|
109
|
+
# rubocop:enable all
|
62
110
|
end
|
@@ -12,5 +12,17 @@ module ApimaticCalculator
|
|
12
12
|
def initialize(file, content_type: 'application/octet-stream')
|
13
13
|
super
|
14
14
|
end
|
15
|
-
|
16
|
-
|
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
|
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:
|
4
|
+
version: 9.6.1
|
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: 2025-03-06 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.11
|
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.11
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: apimatic_faraday_client_adapter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|