cloudmersive-validate-api-client 2.1.3 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -4
- data/docs/BotCheckResponse.md +8 -0
- data/docs/DomainApi.md +275 -0
- data/docs/IPAddressApi.md +165 -0
- data/docs/IPIntelligenceResponse.md +16 -0
- data/docs/IPReverseDNSLookupResponse.md +9 -0
- data/docs/PhishingCheckRequest.md +8 -0
- data/docs/PhishingCheckResponse.md +9 -0
- data/docs/SqlInjectionCheckBatchRequest.md +9 -0
- data/docs/SqlInjectionCheckBatchResponse.md +8 -0
- data/docs/SqlInjectionCheckRequestItem.md +8 -0
- data/docs/SqlInjectionDetectionResult.md +10 -0
- data/docs/TextInputApi.md +115 -1
- data/docs/UrlSafetyCheckRequestFull.md +8 -0
- data/docs/UrlSafetyCheckResponseFull.md +9 -0
- data/docs/UrlSsrfRequestBatch.md +8 -0
- data/docs/UrlSsrfRequestFull.md +9 -0
- data/docs/UrlSsrfResponseBatch.md +8 -0
- data/docs/UrlSsrfResponseFull.md +9 -0
- data/docs/ValidateUrlResponseSyntaxOnly.md +1 -0
- data/lib/cloudmersive-validate-api-client.rb +15 -0
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +270 -0
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +162 -0
- data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +113 -2
- data/lib/cloudmersive-validate-api-client/models/bot_check_response.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +1 -1
- data/lib/cloudmersive-validate-api-client/models/ip_intelligence_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/ip_reverse_dns_lookup_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/phishing_check_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/phishing_check_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_request.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_response.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/sql_injection_check_request_item.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/sql_injection_detection_result.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/url_safety_check_request_full.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/url_safety_check_response_full.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/url_ssrf_request_batch.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/url_ssrf_request_full.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/url_ssrf_response_batch.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/url_ssrf_response_full.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +14 -4
- data/lib/cloudmersive-validate-api-client/version.rb +1 -1
- data/spec/api/domain_api_spec.rb +60 -0
- data/spec/api/ip_address_api_spec.rb +36 -0
- data/spec/api/text_input_api_spec.rb +26 -1
- data/spec/models/bot_check_response_spec.rb +41 -0
- data/spec/models/ip_intelligence_response_spec.rb +89 -0
- data/spec/models/ip_reverse_dns_lookup_response_spec.rb +47 -0
- data/spec/models/phishing_check_request_spec.rb +41 -0
- data/spec/models/phishing_check_response_spec.rb +47 -0
- data/spec/models/sql_injection_check_batch_request_spec.rb +47 -0
- data/spec/models/sql_injection_check_batch_response_spec.rb +41 -0
- data/spec/models/sql_injection_check_request_item_spec.rb +41 -0
- data/spec/models/sql_injection_detection_result_spec.rb +53 -0
- data/spec/models/url_safety_check_request_full_spec.rb +41 -0
- data/spec/models/url_safety_check_response_full_spec.rb +47 -0
- data/spec/models/url_ssrf_request_batch_spec.rb +41 -0
- data/spec/models/url_ssrf_request_full_spec.rb +47 -0
- data/spec/models/url_ssrf_response_batch_spec.rb +41 -0
- data/spec/models/url_ssrf_response_full_spec.rb +47 -0
- data/spec/models/validate_url_response_syntax_only_spec.rb +6 -0
- metadata +47 -2
@@ -13,7 +13,7 @@ Swagger Codegen version: 2.4.14
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module CloudmersiveValidateApiClient
|
16
|
-
# Geolocation result
|
16
|
+
# Geolocation result of performing an IP address geolocation operation. This product includes GeoLite2 data created by MaxMind, available from www.maxmind.com.
|
17
17
|
class GeolocateResponse
|
18
18
|
# Two-letter country code of IP address
|
19
19
|
attr_accessor :country_code
|
@@ -0,0 +1,266 @@
|
|
1
|
+
=begin
|
2
|
+
#validateapi
|
3
|
+
|
4
|
+
#The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
|
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 CloudmersiveValidateApiClient
|
16
|
+
# IP address intelligence result
|
17
|
+
class IPIntelligenceResponse
|
18
|
+
# True if the IP address is a known bot, otherwise false
|
19
|
+
attr_accessor :is_bot
|
20
|
+
|
21
|
+
# True if the IP address is a known Tor exit node, otherwise false
|
22
|
+
attr_accessor :is_tor_node
|
23
|
+
|
24
|
+
# True if the IP address is a known threat IP, otherwise false
|
25
|
+
attr_accessor :is_threat
|
26
|
+
|
27
|
+
# True if the IP address is in the European Union, otherwise false
|
28
|
+
attr_accessor :is_eu
|
29
|
+
|
30
|
+
# Returns the location of the IP address
|
31
|
+
attr_accessor :location
|
32
|
+
|
33
|
+
# ISO 4217 currency code for the IP address location
|
34
|
+
attr_accessor :currency_code
|
35
|
+
|
36
|
+
# Name of the currency in English
|
37
|
+
attr_accessor :currency_name
|
38
|
+
|
39
|
+
# Region (continent) in which the country is located; possible values are None, Europe, Americas, Asia, Africa, Oceania
|
40
|
+
attr_accessor :region_area
|
41
|
+
|
42
|
+
# Subregion in which the country is located; possible values are None, NorthernEurope, WesternEurope, SouthernEurope, EasternEurope, CentralAmerica, NorthernAmerica, SouthAmerica, EasternAfrica, MiddleAfrica, NorthernAfrica , SouthernAfrica , WesternAfrica , CentralAsia , EasternAsia , SouthernAsia , SouthEasternAsia , WesternAsia , Southern , Middle , AustraliaandNewZealand , Melanesia , Polynesia , Micronesia , Caribbean,
|
43
|
+
attr_accessor :subregion_area
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'is_bot' => :'IsBot',
|
49
|
+
:'is_tor_node' => :'IsTorNode',
|
50
|
+
:'is_threat' => :'IsThreat',
|
51
|
+
:'is_eu' => :'IsEU',
|
52
|
+
:'location' => :'Location',
|
53
|
+
:'currency_code' => :'CurrencyCode',
|
54
|
+
:'currency_name' => :'CurrencyName',
|
55
|
+
:'region_area' => :'RegionArea',
|
56
|
+
:'subregion_area' => :'SubregionArea'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.swagger_types
|
62
|
+
{
|
63
|
+
:'is_bot' => :'BOOLEAN',
|
64
|
+
:'is_tor_node' => :'BOOLEAN',
|
65
|
+
:'is_threat' => :'BOOLEAN',
|
66
|
+
:'is_eu' => :'BOOLEAN',
|
67
|
+
:'location' => :'GeolocateResponse',
|
68
|
+
:'currency_code' => :'String',
|
69
|
+
:'currency_name' => :'String',
|
70
|
+
:'region_area' => :'String',
|
71
|
+
:'subregion_area' => :'String'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Initializes the object
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
77
|
+
def initialize(attributes = {})
|
78
|
+
return unless attributes.is_a?(Hash)
|
79
|
+
|
80
|
+
# convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
82
|
+
|
83
|
+
if attributes.has_key?(:'IsBot')
|
84
|
+
self.is_bot = attributes[:'IsBot']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'IsTorNode')
|
88
|
+
self.is_tor_node = attributes[:'IsTorNode']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'IsThreat')
|
92
|
+
self.is_threat = attributes[:'IsThreat']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'IsEU')
|
96
|
+
self.is_eu = attributes[:'IsEU']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'Location')
|
100
|
+
self.location = attributes[:'Location']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.has_key?(:'CurrencyCode')
|
104
|
+
self.currency_code = attributes[:'CurrencyCode']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'CurrencyName')
|
108
|
+
self.currency_name = attributes[:'CurrencyName']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'RegionArea')
|
112
|
+
self.region_area = attributes[:'RegionArea']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'SubregionArea')
|
116
|
+
self.subregion_area = attributes[:'SubregionArea']
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
+
# @return Array for valid properties with the reasons
|
122
|
+
def list_invalid_properties
|
123
|
+
invalid_properties = Array.new
|
124
|
+
invalid_properties
|
125
|
+
end
|
126
|
+
|
127
|
+
# Check to see if the all the properties in the model are valid
|
128
|
+
# @return true if the model is valid
|
129
|
+
def valid?
|
130
|
+
true
|
131
|
+
end
|
132
|
+
|
133
|
+
# Checks equality by comparing each attribute.
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def ==(o)
|
136
|
+
return true if self.equal?(o)
|
137
|
+
self.class == o.class &&
|
138
|
+
is_bot == o.is_bot &&
|
139
|
+
is_tor_node == o.is_tor_node &&
|
140
|
+
is_threat == o.is_threat &&
|
141
|
+
is_eu == o.is_eu &&
|
142
|
+
location == o.location &&
|
143
|
+
currency_code == o.currency_code &&
|
144
|
+
currency_name == o.currency_name &&
|
145
|
+
region_area == o.region_area &&
|
146
|
+
subregion_area == o.subregion_area
|
147
|
+
end
|
148
|
+
|
149
|
+
# @see the `==` method
|
150
|
+
# @param [Object] Object to be compared
|
151
|
+
def eql?(o)
|
152
|
+
self == o
|
153
|
+
end
|
154
|
+
|
155
|
+
# Calculates hash code according to all attributes.
|
156
|
+
# @return [Fixnum] Hash code
|
157
|
+
def hash
|
158
|
+
[is_bot, is_tor_node, is_threat, is_eu, location, currency_code, currency_name, region_area, subregion_area].hash
|
159
|
+
end
|
160
|
+
|
161
|
+
# Builds the object from hash
|
162
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
163
|
+
# @return [Object] Returns the model itself
|
164
|
+
def build_from_hash(attributes)
|
165
|
+
return nil unless attributes.is_a?(Hash)
|
166
|
+
self.class.swagger_types.each_pair do |key, type|
|
167
|
+
if type =~ /\AArray<(.*)>/i
|
168
|
+
# check to ensure the input is an array given that the attribute
|
169
|
+
# is documented as an array but the input is not
|
170
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
171
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
172
|
+
end
|
173
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
174
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
175
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
176
|
+
end
|
177
|
+
|
178
|
+
self
|
179
|
+
end
|
180
|
+
|
181
|
+
# Deserializes the data based on type
|
182
|
+
# @param string type Data type
|
183
|
+
# @param string value Value to be deserialized
|
184
|
+
# @return [Object] Deserialized data
|
185
|
+
def _deserialize(type, value)
|
186
|
+
case type.to_sym
|
187
|
+
when :DateTime
|
188
|
+
DateTime.parse(value)
|
189
|
+
when :Date
|
190
|
+
Date.parse(value)
|
191
|
+
when :String
|
192
|
+
value.to_s
|
193
|
+
when :Integer
|
194
|
+
value.to_i
|
195
|
+
when :Float
|
196
|
+
value.to_f
|
197
|
+
when :BOOLEAN
|
198
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
199
|
+
true
|
200
|
+
else
|
201
|
+
false
|
202
|
+
end
|
203
|
+
when :Object
|
204
|
+
# generic object (usually a Hash), return directly
|
205
|
+
value
|
206
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
207
|
+
inner_type = Regexp.last_match[:inner_type]
|
208
|
+
value.map { |v| _deserialize(inner_type, v) }
|
209
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
210
|
+
k_type = Regexp.last_match[:k_type]
|
211
|
+
v_type = Regexp.last_match[:v_type]
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each do |k, v|
|
214
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
else # model
|
218
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
219
|
+
temp_model.build_from_hash(value)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the string representation of the object
|
224
|
+
# @return [String] String presentation of the object
|
225
|
+
def to_s
|
226
|
+
to_hash.to_s
|
227
|
+
end
|
228
|
+
|
229
|
+
# to_body is an alias to to_hash (backward compatibility)
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
231
|
+
def to_body
|
232
|
+
to_hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the object in the form of hash
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
237
|
+
def to_hash
|
238
|
+
hash = {}
|
239
|
+
self.class.attribute_map.each_pair do |attr, param|
|
240
|
+
value = self.send(attr)
|
241
|
+
next if value.nil?
|
242
|
+
hash[param] = _to_hash(value)
|
243
|
+
end
|
244
|
+
hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Outputs non-array value in the form of hash
|
248
|
+
# For object, use to_hash. Otherwise, just return the value
|
249
|
+
# @param [Object] value Any valid value
|
250
|
+
# @return [Hash] Returns the value in the form of hash
|
251
|
+
def _to_hash(value)
|
252
|
+
if value.is_a?(Array)
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
254
|
+
elsif value.is_a?(Hash)
|
255
|
+
{}.tap do |hash|
|
256
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
257
|
+
end
|
258
|
+
elsif value.respond_to? :to_hash
|
259
|
+
value.to_hash
|
260
|
+
else
|
261
|
+
value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
#validateapi
|
3
|
+
|
4
|
+
#The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
|
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 CloudmersiveValidateApiClient
|
16
|
+
# Result of performing a Reverse Domain (DNS) lookup on an IP address
|
17
|
+
class IPReverseDNSLookupResponse
|
18
|
+
# True if a domain was found, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# Host name (fully-qualified) associated with the IP address, if any
|
22
|
+
attr_accessor :host_name
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'successful' => :'Successful',
|
28
|
+
:'host_name' => :'HostName'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'successful' => :'BOOLEAN',
|
36
|
+
:'host_name' => :'String'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
return unless attributes.is_a?(Hash)
|
44
|
+
|
45
|
+
# convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
47
|
+
|
48
|
+
if attributes.has_key?(:'Successful')
|
49
|
+
self.successful = attributes[:'Successful']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'HostName')
|
53
|
+
self.host_name = attributes[:'HostName']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
invalid_properties
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check to see if the all the properties in the model are valid
|
65
|
+
# @return true if the model is valid
|
66
|
+
def valid?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(o)
|
73
|
+
return true if self.equal?(o)
|
74
|
+
self.class == o.class &&
|
75
|
+
successful == o.successful &&
|
76
|
+
host_name == o.host_name
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def eql?(o)
|
82
|
+
self == o
|
83
|
+
end
|
84
|
+
|
85
|
+
# Calculates hash code according to all attributes.
|
86
|
+
# @return [Fixnum] Hash code
|
87
|
+
def hash
|
88
|
+
[successful, host_name].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def build_from_hash(attributes)
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
96
|
+
self.class.swagger_types.each_pair do |key, type|
|
97
|
+
if type =~ /\AArray<(.*)>/i
|
98
|
+
# check to ensure the input is an array given that the attribute
|
99
|
+
# is documented as an array but the input is not
|
100
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
102
|
+
end
|
103
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
104
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
105
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
106
|
+
end
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
# Deserializes the data based on type
|
112
|
+
# @param string type Data type
|
113
|
+
# @param string value Value to be deserialized
|
114
|
+
# @return [Object] Deserialized data
|
115
|
+
def _deserialize(type, value)
|
116
|
+
case type.to_sym
|
117
|
+
when :DateTime
|
118
|
+
DateTime.parse(value)
|
119
|
+
when :Date
|
120
|
+
Date.parse(value)
|
121
|
+
when :String
|
122
|
+
value.to_s
|
123
|
+
when :Integer
|
124
|
+
value.to_i
|
125
|
+
when :Float
|
126
|
+
value.to_f
|
127
|
+
when :BOOLEAN
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
129
|
+
true
|
130
|
+
else
|
131
|
+
false
|
132
|
+
end
|
133
|
+
when :Object
|
134
|
+
# generic object (usually a Hash), return directly
|
135
|
+
value
|
136
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
137
|
+
inner_type = Regexp.last_match[:inner_type]
|
138
|
+
value.map { |v| _deserialize(inner_type, v) }
|
139
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
140
|
+
k_type = Regexp.last_match[:k_type]
|
141
|
+
v_type = Regexp.last_match[:v_type]
|
142
|
+
{}.tap do |hash|
|
143
|
+
value.each do |k, v|
|
144
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else # model
|
148
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
149
|
+
temp_model.build_from_hash(value)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the string representation of the object
|
154
|
+
# @return [String] String presentation of the object
|
155
|
+
def to_s
|
156
|
+
to_hash.to_s
|
157
|
+
end
|
158
|
+
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_body
|
162
|
+
to_hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the object in the form of hash
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_hash
|
168
|
+
hash = {}
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
170
|
+
value = self.send(attr)
|
171
|
+
next if value.nil?
|
172
|
+
hash[param] = _to_hash(value)
|
173
|
+
end
|
174
|
+
hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Outputs non-array value in the form of hash
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
179
|
+
# @param [Object] value Any valid value
|
180
|
+
# @return [Hash] Returns the value in the form of hash
|
181
|
+
def _to_hash(value)
|
182
|
+
if value.is_a?(Array)
|
183
|
+
value.compact.map { |v| _to_hash(v) }
|
184
|
+
elsif value.is_a?(Hash)
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
187
|
+
end
|
188
|
+
elsif value.respond_to? :to_hash
|
189
|
+
value.to_hash
|
190
|
+
else
|
191
|
+
value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
end
|