cloudmersive-security-api-client 2.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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +119 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-security-api-client.gemspec +45 -0
  6. data/docs/ContentThreatDetectionApi.md +283 -0
  7. data/docs/IPThreatDetectionResponse.md +9 -0
  8. data/docs/NetworkThreatDetectionApi.md +228 -0
  9. data/docs/StringAutomaticThreatDetection.md +18 -0
  10. data/docs/StringInsecureDeserializationJsonDetection.md +10 -0
  11. data/docs/StringSqlInjectionDetectionResult.md +10 -0
  12. data/docs/StringXssProtectionResult.md +11 -0
  13. data/docs/StringXxeDetectionResult.md +9 -0
  14. data/docs/ThreatDetectionBotCheckResponse.md +8 -0
  15. data/docs/ThreatDetectionTorNodeResponse.md +8 -0
  16. data/docs/UrlSsrfThreatDetectionRequestFull.md +9 -0
  17. data/docs/UrlSsrfThreatDetectionResponseFull.md +9 -0
  18. data/git_push.sh +55 -0
  19. data/lib/cloudmersive-security-api-client.rb +51 -0
  20. data/lib/cloudmersive-security-api-client/api/content_threat_detection_api.rb +293 -0
  21. data/lib/cloudmersive-security-api-client/api/network_threat_detection_api.rb +239 -0
  22. data/lib/cloudmersive-security-api-client/api_client.rb +391 -0
  23. data/lib/cloudmersive-security-api-client/api_error.rb +38 -0
  24. data/lib/cloudmersive-security-api-client/configuration.rb +209 -0
  25. data/lib/cloudmersive-security-api-client/models/ip_threat_detection_response.rb +196 -0
  26. data/lib/cloudmersive-security-api-client/models/string_automatic_threat_detection.rb +285 -0
  27. data/lib/cloudmersive-security-api-client/models/string_insecure_deserialization_json_detection.rb +206 -0
  28. data/lib/cloudmersive-security-api-client/models/string_sql_injection_detection_result.rb +206 -0
  29. data/lib/cloudmersive-security-api-client/models/string_xss_protection_result.rb +216 -0
  30. data/lib/cloudmersive-security-api-client/models/string_xxe_detection_result.rb +196 -0
  31. data/lib/cloudmersive-security-api-client/models/threat_detection_bot_check_response.rb +186 -0
  32. data/lib/cloudmersive-security-api-client/models/threat_detection_tor_node_response.rb +186 -0
  33. data/lib/cloudmersive-security-api-client/models/url_ssrf_threat_detection_request_full.rb +198 -0
  34. data/lib/cloudmersive-security-api-client/models/url_ssrf_threat_detection_response_full.rb +196 -0
  35. data/lib/cloudmersive-security-api-client/version.rb +15 -0
  36. data/spec/api/content_threat_detection_api_spec.rb +95 -0
  37. data/spec/api/network_threat_detection_api_spec.rb +83 -0
  38. data/spec/api_client_spec.rb +243 -0
  39. data/spec/configuration_spec.rb +42 -0
  40. data/spec/models/ip_threat_detection_response_spec.rb +47 -0
  41. data/spec/models/string_automatic_threat_detection_spec.rb +101 -0
  42. data/spec/models/string_insecure_deserialization_json_detection_spec.rb +53 -0
  43. data/spec/models/string_sql_injection_detection_result_spec.rb +53 -0
  44. data/spec/models/string_xss_protection_result_spec.rb +59 -0
  45. data/spec/models/string_xxe_detection_result_spec.rb +47 -0
  46. data/spec/models/threat_detection_bot_check_response_spec.rb +41 -0
  47. data/spec/models/threat_detection_tor_node_response_spec.rb +41 -0
  48. data/spec/models/url_ssrf_threat_detection_request_full_spec.rb +47 -0
  49. data/spec/models/url_ssrf_threat_detection_response_full_spec.rb +47 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +273 -0
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveSecurityApiClient
16
+ # Result of performing an Insecure Deserialization JSON protection operation
17
+ class StringInsecureDeserializationJsonDetection
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the input contained Insecure Deserialization JSON, false otherwise
22
+ attr_accessor :contained_json_insecure_deserialization_attack
23
+
24
+ # Original input string
25
+ attr_accessor :original_input
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'successful' => :'Successful',
31
+ :'contained_json_insecure_deserialization_attack' => :'ContainedJsonInsecureDeserializationAttack',
32
+ :'original_input' => :'OriginalInput'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'successful' => :'BOOLEAN',
40
+ :'contained_json_insecure_deserialization_attack' => :'BOOLEAN',
41
+ :'original_input' => :'String'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'Successful')
54
+ self.successful = attributes[:'Successful']
55
+ end
56
+
57
+ if attributes.has_key?(:'ContainedJsonInsecureDeserializationAttack')
58
+ self.contained_json_insecure_deserialization_attack = attributes[:'ContainedJsonInsecureDeserializationAttack']
59
+ end
60
+
61
+ if attributes.has_key?(:'OriginalInput')
62
+ self.original_input = attributes[:'OriginalInput']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ successful == o.successful &&
85
+ contained_json_insecure_deserialization_attack == o.contained_json_insecure_deserialization_attack &&
86
+ original_input == o.original_input
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [successful, contained_json_insecure_deserialization_attack, original_input].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = CloudmersiveSecurityApiClient.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+ end
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveSecurityApiClient
16
+ # Result of performing an SQL Injection protection operation
17
+ class StringSqlInjectionDetectionResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the input contained SQL Injection attacks, false otherwise
22
+ attr_accessor :contained_sql_injection_attack
23
+
24
+ # Original input string
25
+ attr_accessor :original_input
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'successful' => :'Successful',
31
+ :'contained_sql_injection_attack' => :'ContainedSqlInjectionAttack',
32
+ :'original_input' => :'OriginalInput'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'successful' => :'BOOLEAN',
40
+ :'contained_sql_injection_attack' => :'BOOLEAN',
41
+ :'original_input' => :'String'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'Successful')
54
+ self.successful = attributes[:'Successful']
55
+ end
56
+
57
+ if attributes.has_key?(:'ContainedSqlInjectionAttack')
58
+ self.contained_sql_injection_attack = attributes[:'ContainedSqlInjectionAttack']
59
+ end
60
+
61
+ if attributes.has_key?(:'OriginalInput')
62
+ self.original_input = attributes[:'OriginalInput']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ successful == o.successful &&
85
+ contained_sql_injection_attack == o.contained_sql_injection_attack &&
86
+ original_input == o.original_input
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [successful, contained_sql_injection_attack, original_input].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = CloudmersiveSecurityApiClient.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveSecurityApiClient
16
+ # Result of performing an XSS protection operation
17
+ class StringXssProtectionResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the input contained XSS scripting, false otherwise
22
+ attr_accessor :contained_xss
23
+
24
+ # Original input string
25
+ attr_accessor :original_input
26
+
27
+ # Normalized string result, with XSS removed
28
+ attr_accessor :normalized_result
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'successful' => :'Successful',
34
+ :'contained_xss' => :'ContainedXss',
35
+ :'original_input' => :'OriginalInput',
36
+ :'normalized_result' => :'NormalizedResult'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'successful' => :'BOOLEAN',
44
+ :'contained_xss' => :'BOOLEAN',
45
+ :'original_input' => :'String',
46
+ :'normalized_result' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'Successful')
59
+ self.successful = attributes[:'Successful']
60
+ end
61
+
62
+ if attributes.has_key?(:'ContainedXss')
63
+ self.contained_xss = attributes[:'ContainedXss']
64
+ end
65
+
66
+ if attributes.has_key?(:'OriginalInput')
67
+ self.original_input = attributes[:'OriginalInput']
68
+ end
69
+
70
+ if attributes.has_key?(:'NormalizedResult')
71
+ self.normalized_result = attributes[:'NormalizedResult']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ successful == o.successful &&
94
+ contained_xss == o.contained_xss &&
95
+ original_input == o.original_input &&
96
+ normalized_result == o.normalized_result
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [successful, contained_xss, original_input, normalized_result].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = CloudmersiveSecurityApiClient.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+ end