cloudmersive-validate-api-client 1.4.2 → 2.0.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/Gemfile +1 -1
- data/README.md +22 -7
- data/cloudmersive-validate-api-client.gemspec +3 -3
- data/docs/AddressApi.md +270 -1
- data/docs/CountryDetails.md +11 -0
- data/docs/CountryListResult.md +9 -0
- data/docs/DomainApi.md +2 -2
- data/docs/EmailApi.md +3 -3
- data/docs/IPAddressApi.md +56 -1
- data/docs/TorNodeResponse.md +8 -0
- data/docs/ValidateCityRequest.md +11 -0
- data/docs/ValidateCityResponse.md +12 -0
- data/docs/ValidateCountryResponse.md +1 -0
- data/docs/ValidatePostalCodeRequest.md +10 -0
- data/docs/ValidatePostalCodeResponse.md +12 -0
- data/docs/ValidateStateRequest.md +10 -0
- data/docs/ValidateStateResponse.md +11 -0
- data/lib/cloudmersive-validate-api-client.rb +10 -1
- data/lib/cloudmersive-validate-api-client/api/address_api.rb +276 -18
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +14 -18
- data/lib/cloudmersive-validate-api-client/api/email_api.rb +11 -14
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +58 -5
- data/lib/cloudmersive-validate-api-client/api/lead_enrichment_api.rb +5 -8
- data/lib/cloudmersive-validate-api-client/api/name_api.rb +17 -22
- data/lib/cloudmersive-validate-api-client/api/phone_number_api.rb +5 -6
- data/lib/cloudmersive-validate-api-client/api/user_agent_api.rb +5 -6
- data/lib/cloudmersive-validate-api-client/api/vat_api.rb +5 -6
- data/lib/cloudmersive-validate-api-client/api_client.rb +11 -9
- data/lib/cloudmersive-validate-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-validate-api-client/configuration.rb +2 -2
- data/lib/cloudmersive-validate-api-client/models/address_get_servers_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/address_verify_syntax_only_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/check_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/country_details.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/country_list_result.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/first_name_validation_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/first_name_validation_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/full_email_validation_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/full_name_validation_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/full_name_validation_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/get_gender_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/get_gender_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/get_timezones_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/get_timezones_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/last_name_validation_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/last_name_validation_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/lead_enrichment_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/lead_enrichment_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/parse_address_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/parse_address_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/phone_number_validate_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/phone_number_validation_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/timezone.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/tor_node_response.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_address_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_address_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_city_request.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/validate_city_response.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/validate_country_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_country_response.rb +18 -11
- data/lib/cloudmersive-validate-api-client/models/validate_identifier_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_identifier_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_postal_code_request.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/validate_postal_code_response.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/validate_state_request.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/validate_state_response.rb +216 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_request_full.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_url_request_syntax_only.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_full.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/vat_lookup_request.rb +7 -10
- data/lib/cloudmersive-validate-api-client/models/vat_lookup_response.rb +7 -11
- data/lib/cloudmersive-validate-api-client/models/whois_response.rb +7 -10
- data/lib/cloudmersive-validate-api-client/version.rb +2 -2
- data/spec/api/address_api_spec.rb +65 -6
- data/spec/api/domain_api_spec.rb +5 -5
- data/spec/api/email_api_spec.rb +4 -4
- data/spec/api/ip_address_api_spec.rb +14 -2
- data/spec/api/lead_enrichment_api_spec.rb +2 -3
- data/spec/api/name_api_spec.rb +6 -6
- data/spec/api/phone_number_api_spec.rb +2 -2
- data/spec/api/user_agent_api_spec.rb +2 -2
- data/spec/api/vat_api_spec.rb +2 -2
- data/spec/api_client_spec.rb +52 -35
- data/spec/configuration_spec.rb +9 -9
- data/spec/models/address_get_servers_response_spec.rb +3 -4
- data/spec/models/address_verify_syntax_only_response_spec.rb +5 -6
- data/spec/models/check_response_spec.rb +2 -3
- data/spec/models/country_details_spec.rb +59 -0
- data/spec/models/country_list_result_spec.rb +47 -0
- data/spec/models/first_name_validation_request_spec.rb +2 -3
- data/spec/models/first_name_validation_response_spec.rb +3 -4
- data/spec/models/full_email_validation_response_spec.rb +10 -11
- data/spec/models/full_name_validation_request_spec.rb +2 -3
- data/spec/models/full_name_validation_response_spec.rb +11 -12
- data/spec/models/geolocate_response_spec.rb +10 -11
- data/spec/models/get_gender_request_spec.rb +3 -4
- data/spec/models/get_gender_response_spec.rb +3 -4
- data/spec/models/get_timezones_request_spec.rb +2 -3
- data/spec/models/get_timezones_response_spec.rb +7 -8
- data/spec/models/last_name_validation_request_spec.rb +2 -3
- data/spec/models/last_name_validation_response_spec.rb +3 -4
- data/spec/models/lead_enrichment_request_spec.rb +15 -16
- data/spec/models/lead_enrichment_response_spec.rb +19 -20
- data/spec/models/parse_address_request_spec.rb +3 -4
- data/spec/models/parse_address_response_spec.rb +10 -11
- data/spec/models/phone_number_validate_request_spec.rb +3 -4
- data/spec/models/phone_number_validation_response_spec.rb +9 -10
- data/spec/models/timezone_spec.rb +4 -5
- data/spec/models/tor_node_response_spec.rb +41 -0
- data/spec/models/user_agent_validate_request_spec.rb +2 -3
- data/spec/models/user_agent_validate_response_spec.rb +15 -16
- data/spec/models/validate_address_request_spec.rb +7 -8
- data/spec/models/validate_address_response_spec.rb +4 -5
- data/spec/models/validate_city_request_spec.rb +59 -0
- data/spec/models/validate_city_response_spec.rb +65 -0
- data/spec/models/validate_country_request_spec.rb +2 -3
- data/spec/models/validate_country_response_spec.rb +13 -8
- data/spec/models/validate_identifier_request_spec.rb +9 -10
- data/spec/models/validate_identifier_response_spec.rb +3 -4
- data/spec/models/validate_postal_code_request_spec.rb +53 -0
- data/spec/models/validate_postal_code_response_spec.rb +65 -0
- data/spec/models/validate_state_request_spec.rb +53 -0
- data/spec/models/validate_state_response_spec.rb +59 -0
- data/spec/models/validate_url_request_full_spec.rb +2 -3
- data/spec/models/validate_url_request_syntax_only_spec.rb +2 -3
- data/spec/models/validate_url_response_full_spec.rb +6 -7
- data/spec/models/validate_url_response_syntax_only_spec.rb +3 -4
- data/spec/models/vat_lookup_request_spec.rb +2 -3
- data/spec/models/vat_lookup_response_spec.rb +13 -14
- data/spec/models/whois_response_spec.rb +16 -17
- data/spec/spec_helper.rb +1 -1
- metadata +29 -2
@@ -0,0 +1,216 @@
|
|
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
|
+
# Details of one country
|
17
|
+
class CountryDetails
|
18
|
+
# Name of the country
|
19
|
+
attr_accessor :country_name
|
20
|
+
|
21
|
+
# Three-letter ISO 3166-1 country code
|
22
|
+
attr_accessor :three_letter_code
|
23
|
+
|
24
|
+
# Two-letter ISO 3166-1 country code
|
25
|
+
attr_accessor :iso_two_letter_code
|
26
|
+
|
27
|
+
# True if this country is currently a member of the European Union (EU), false otherwise
|
28
|
+
attr_accessor :is_european_union_member
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'country_name' => :'CountryName',
|
34
|
+
:'three_letter_code' => :'ThreeLetterCode',
|
35
|
+
:'iso_two_letter_code' => :'ISOTwoLetterCode',
|
36
|
+
:'is_european_union_member' => :'IsEuropeanUnionMember'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'country_name' => :'String',
|
44
|
+
:'three_letter_code' => :'String',
|
45
|
+
:'iso_two_letter_code' => :'String',
|
46
|
+
:'is_european_union_member' => :'BOOLEAN'
|
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?(:'CountryName')
|
59
|
+
self.country_name = attributes[:'CountryName']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'ThreeLetterCode')
|
63
|
+
self.three_letter_code = attributes[:'ThreeLetterCode']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'ISOTwoLetterCode')
|
67
|
+
self.iso_two_letter_code = attributes[:'ISOTwoLetterCode']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'IsEuropeanUnionMember')
|
71
|
+
self.is_european_union_member = attributes[:'IsEuropeanUnionMember']
|
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
|
+
country_name == o.country_name &&
|
94
|
+
three_letter_code == o.three_letter_code &&
|
95
|
+
iso_two_letter_code == o.iso_two_letter_code &&
|
96
|
+
is_european_union_member == o.is_european_union_member
|
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
|
+
[country_name, three_letter_code, iso_two_letter_code, is_european_union_member].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 = CloudmersiveValidateApiClient.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
|
@@ -0,0 +1,198 @@
|
|
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 enumerating available countries
|
17
|
+
class CountryListResult
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# List of current ISO 3166-1 countries in the world
|
22
|
+
attr_accessor :countries
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'successful' => :'Successful',
|
28
|
+
:'countries' => :'Countries'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'successful' => :'BOOLEAN',
|
36
|
+
:'countries' => :'Array<CountryDetails>'
|
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?(:'Countries')
|
53
|
+
if (value = attributes[:'Countries']).is_a?(Array)
|
54
|
+
self.countries = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
60
|
+
# @return Array for valid properties with the reasons
|
61
|
+
def list_invalid_properties
|
62
|
+
invalid_properties = Array.new
|
63
|
+
invalid_properties
|
64
|
+
end
|
65
|
+
|
66
|
+
# Check to see if the all the properties in the model are valid
|
67
|
+
# @return true if the model is valid
|
68
|
+
def valid?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
# Checks equality by comparing each attribute.
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def ==(o)
|
75
|
+
return true if self.equal?(o)
|
76
|
+
self.class == o.class &&
|
77
|
+
successful == o.successful &&
|
78
|
+
countries == o.countries
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Fixnum] Hash code
|
89
|
+
def hash
|
90
|
+
[successful, countries].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.swagger_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :BOOLEAN
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
151
|
+
temp_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -18,7 +18,6 @@ module CloudmersiveValidateApiClient
|
|
18
18
|
# First name to process
|
19
19
|
attr_accessor :first_name
|
20
20
|
|
21
|
-
|
22
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
22
|
def self.attribute_map
|
24
23
|
{
|
@@ -39,25 +38,24 @@ module CloudmersiveValidateApiClient
|
|
39
38
|
return unless attributes.is_a?(Hash)
|
40
39
|
|
41
40
|
# convert string to symbol for hash key
|
42
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
43
42
|
|
44
43
|
if attributes.has_key?(:'FirstName')
|
45
44
|
self.first_name = attributes[:'FirstName']
|
46
45
|
end
|
47
|
-
|
48
46
|
end
|
49
47
|
|
50
48
|
# Show invalid properties with the reasons. Usually used together with valid?
|
51
49
|
# @return Array for valid properties with the reasons
|
52
50
|
def list_invalid_properties
|
53
51
|
invalid_properties = Array.new
|
54
|
-
|
52
|
+
invalid_properties
|
55
53
|
end
|
56
54
|
|
57
55
|
# Check to see if the all the properties in the model are valid
|
58
56
|
# @return true if the model is valid
|
59
57
|
def valid?
|
60
|
-
|
58
|
+
true
|
61
59
|
end
|
62
60
|
|
63
61
|
# Checks equality by comparing each attribute.
|
@@ -87,10 +85,10 @@ module CloudmersiveValidateApiClient
|
|
87
85
|
return nil unless attributes.is_a?(Hash)
|
88
86
|
self.class.swagger_types.each_pair do |key, type|
|
89
87
|
if type =~ /\AArray<(.*)>/i
|
90
|
-
# check to ensure the input is an array given that the
|
88
|
+
# check to ensure the input is an array given that the attribute
|
91
89
|
# is documented as an array but the input is not
|
92
90
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
93
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
91
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
94
92
|
end
|
95
93
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
96
94
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -172,7 +170,7 @@ module CloudmersiveValidateApiClient
|
|
172
170
|
# @return [Hash] Returns the value in the form of hash
|
173
171
|
def _to_hash(value)
|
174
172
|
if value.is_a?(Array)
|
175
|
-
value.compact.map{ |v| _to_hash(v) }
|
173
|
+
value.compact.map { |v| _to_hash(v) }
|
176
174
|
elsif value.is_a?(Hash)
|
177
175
|
{}.tap do |hash|
|
178
176
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -185,5 +183,4 @@ module CloudmersiveValidateApiClient
|
|
185
183
|
end
|
186
184
|
|
187
185
|
end
|
188
|
-
|
189
186
|
end
|