cloudmersive-validate-api-client 2.0.6 → 2.1.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -4
  3. data/docs/AddressApi.md +220 -0
  4. data/docs/CountryDetails.md +5 -0
  5. data/docs/DomainApi.md +55 -0
  6. data/docs/DomainQualityResponse.md +8 -0
  7. data/docs/GeolocateStreetAddressResponse.md +13 -0
  8. data/docs/IPAddressApi.md +55 -0
  9. data/docs/ReverseGeocodeAddressRequest.md +9 -0
  10. data/docs/ReverseGeocodeAddressResponse.md +14 -0
  11. data/docs/TextInputApi.md +118 -0
  12. data/docs/ValidateCountryResponse.md +5 -0
  13. data/docs/XssProtectionResult.md +11 -0
  14. data/lib/cloudmersive-validate-api-client.rb +6 -0
  15. data/lib/cloudmersive-validate-api-client/api/address_api.rb +216 -0
  16. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +54 -0
  17. data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +54 -0
  18. data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +131 -0
  19. data/lib/cloudmersive-validate-api-client/models/country_details.rb +54 -4
  20. data/lib/cloudmersive-validate-api-client/models/domain_quality_response.rb +186 -0
  21. data/lib/cloudmersive-validate-api-client/models/geolocate_street_address_response.rb +236 -0
  22. data/lib/cloudmersive-validate-api-client/models/reverse_geocode_address_request.rb +196 -0
  23. data/lib/cloudmersive-validate-api-client/models/reverse_geocode_address_response.rb +246 -0
  24. data/lib/cloudmersive-validate-api-client/models/validate_country_response.rb +54 -4
  25. data/lib/cloudmersive-validate-api-client/models/xss_protection_result.rb +216 -0
  26. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  27. data/spec/api/address_api_spec.rb +48 -0
  28. data/spec/api/domain_api_spec.rb +12 -0
  29. data/spec/api/ip_address_api_spec.rb +12 -0
  30. data/spec/api/text_input_api_spec.rb +59 -0
  31. data/spec/models/country_details_spec.rb +30 -0
  32. data/spec/models/domain_quality_response_spec.rb +41 -0
  33. data/spec/models/geolocate_street_address_response_spec.rb +71 -0
  34. data/spec/models/reverse_geocode_address_request_spec.rb +47 -0
  35. data/spec/models/reverse_geocode_address_response_spec.rb +77 -0
  36. data/spec/models/validate_country_response_spec.rb +30 -0
  37. data/spec/models/xss_protection_result_spec.rb +59 -0
  38. metadata +20 -2
@@ -0,0 +1,236 @@
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
+ # Geolocation street address result
17
+ class GeolocateStreetAddressResponse
18
+ # Two-letter country code of IP address
19
+ attr_accessor :country_code
20
+
21
+ # Country name of IP address
22
+ attr_accessor :country_name
23
+
24
+ # Street address of IP address
25
+ attr_accessor :street_address
26
+
27
+ # City of IP address
28
+ attr_accessor :city
29
+
30
+ # State/region of IP address
31
+ attr_accessor :region_name
32
+
33
+ # Zip or postal code of IP address
34
+ attr_accessor :zip_code
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'country_code' => :'CountryCode',
40
+ :'country_name' => :'CountryName',
41
+ :'street_address' => :'StreetAddress',
42
+ :'city' => :'City',
43
+ :'region_name' => :'RegionName',
44
+ :'zip_code' => :'ZipCode'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'country_code' => :'String',
52
+ :'country_name' => :'String',
53
+ :'street_address' => :'String',
54
+ :'city' => :'String',
55
+ :'region_name' => :'String',
56
+ :'zip_code' => :'String'
57
+ }
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
+
68
+ if attributes.has_key?(:'CountryCode')
69
+ self.country_code = attributes[:'CountryCode']
70
+ end
71
+
72
+ if attributes.has_key?(:'CountryName')
73
+ self.country_name = attributes[:'CountryName']
74
+ end
75
+
76
+ if attributes.has_key?(:'StreetAddress')
77
+ self.street_address = attributes[:'StreetAddress']
78
+ end
79
+
80
+ if attributes.has_key?(:'City')
81
+ self.city = attributes[:'City']
82
+ end
83
+
84
+ if attributes.has_key?(:'RegionName')
85
+ self.region_name = attributes[:'RegionName']
86
+ end
87
+
88
+ if attributes.has_key?(:'ZipCode')
89
+ self.zip_code = attributes[:'ZipCode']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ country_code == o.country_code &&
112
+ country_name == o.country_name &&
113
+ street_address == o.street_address &&
114
+ city == o.city &&
115
+ region_name == o.region_name &&
116
+ zip_code == o.zip_code
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [country_code, country_name, street_address, city, region_name, zip_code].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ 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
+ # Request to reverse geocode a Street Address
17
+ class ReverseGeocodeAddressRequest
18
+ # Latitude coordinate in WGS84 format
19
+ attr_accessor :latitude
20
+
21
+ # Longitude coordinate in WGS84 format
22
+ attr_accessor :longitude
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'latitude' => :'Latitude',
28
+ :'longitude' => :'Longitude'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'latitude' => :'Float',
36
+ :'longitude' => :'Float'
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?(:'Latitude')
49
+ self.latitude = attributes[:'Latitude']
50
+ end
51
+
52
+ if attributes.has_key?(:'Longitude')
53
+ self.longitude = attributes[:'Longitude']
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
+ latitude == o.latitude &&
76
+ longitude == o.longitude
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
+ [latitude, longitude].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
@@ -0,0 +1,246 @@
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 reverse geocoding a street address
17
+ class ReverseGeocodeAddressResponse
18
+ # True if the address operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Street address to validate, such as '2950 Buskirk Ave.'
22
+ attr_accessor :street_address
23
+
24
+ # City part of the addrerss to validate, such as 'Walnut Creek'
25
+ attr_accessor :city
26
+
27
+ # State or province of the address to validate, such as 'CA' or 'California'
28
+ attr_accessor :state_or_province
29
+
30
+ # Zip code or postal code of the address to validate, such as '94597'
31
+ attr_accessor :postal_code
32
+
33
+ # Name of the country, such as 'United States'. Global countries are supported.
34
+ attr_accessor :country_full_name
35
+
36
+ # Three-letter ISO 3166-1 country code
37
+ attr_accessor :country_code
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'successful' => :'Successful',
43
+ :'street_address' => :'StreetAddress',
44
+ :'city' => :'City',
45
+ :'state_or_province' => :'StateOrProvince',
46
+ :'postal_code' => :'PostalCode',
47
+ :'country_full_name' => :'CountryFullName',
48
+ :'country_code' => :'CountryCode'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'successful' => :'BOOLEAN',
56
+ :'street_address' => :'String',
57
+ :'city' => :'String',
58
+ :'state_or_province' => :'String',
59
+ :'postal_code' => :'String',
60
+ :'country_full_name' => :'String',
61
+ :'country_code' => :'String'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'Successful')
74
+ self.successful = attributes[:'Successful']
75
+ end
76
+
77
+ if attributes.has_key?(:'StreetAddress')
78
+ self.street_address = attributes[:'StreetAddress']
79
+ end
80
+
81
+ if attributes.has_key?(:'City')
82
+ self.city = attributes[:'City']
83
+ end
84
+
85
+ if attributes.has_key?(:'StateOrProvince')
86
+ self.state_or_province = attributes[:'StateOrProvince']
87
+ end
88
+
89
+ if attributes.has_key?(:'PostalCode')
90
+ self.postal_code = attributes[:'PostalCode']
91
+ end
92
+
93
+ if attributes.has_key?(:'CountryFullName')
94
+ self.country_full_name = attributes[:'CountryFullName']
95
+ end
96
+
97
+ if attributes.has_key?(:'CountryCode')
98
+ self.country_code = attributes[:'CountryCode']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ successful == o.successful &&
121
+ street_address == o.street_address &&
122
+ city == o.city &&
123
+ state_or_province == o.state_or_province &&
124
+ postal_code == o.postal_code &&
125
+ country_full_name == o.country_full_name &&
126
+ country_code == o.country_code
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Fixnum] Hash code
137
+ def hash
138
+ [successful, street_address, city, state_or_province, postal_code, country_full_name, country_code].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.swagger_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :BOOLEAN
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
199
+ temp_model.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ next if value.nil?
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+
245
+ end
246
+ end