cloudmersive-validate-api-client 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -4
- data/docs/AddressApi.md +55 -0
- data/docs/DateTimeApi.md +222 -0
- data/docs/DateTimeNaturalLanguageParseRequest.md +8 -0
- data/docs/DateTimeNowResult.md +10 -0
- data/docs/DateTimeStandardizedParseRequest.md +9 -0
- data/docs/DateTimeStandardizedParseResponse.md +16 -0
- data/docs/DomainApi.md +3 -3
- data/docs/EmailApi.md +3 -3
- data/docs/GetPublicHolidaysRequest.md +9 -0
- data/docs/IPAddressApi.md +4 -4
- data/docs/NormalizeAddressResponse.md +18 -0
- data/docs/PublicHolidayOccurrence.md +12 -0
- data/docs/PublicHolidaysResponse.md +9 -0
- data/docs/TextInputApi.md +2 -2
- data/lib/cloudmersive-validate-api-client.rb +9 -0
- data/lib/cloudmersive-validate-api-client/api/address_api.rb +54 -0
- data/lib/cloudmersive-validate-api-client/api/date_time_api.rb +231 -0
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +3 -3
- data/lib/cloudmersive-validate-api-client/api/email_api.rb +3 -3
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +4 -4
- data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +2 -2
- data/lib/cloudmersive-validate-api-client/models/date_time_natural_language_parse_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_now_result.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/get_public_holidays_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/normalize_address_response.rb +286 -0
- data/lib/cloudmersive-validate-api-client/models/public_holiday_occurrence.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/public_holidays_response.rb +198 -0
- data/lib/cloudmersive-validate-api-client/version.rb +1 -1
- data/spec/api/address_api_spec.rb +12 -0
- data/spec/api/date_time_api_spec.rb +82 -0
- data/spec/models/date_time_natural_language_parse_request_spec.rb +41 -0
- data/spec/models/date_time_now_result_spec.rb +53 -0
- data/spec/models/date_time_standardized_parse_request_spec.rb +47 -0
- data/spec/models/date_time_standardized_parse_response_spec.rb +89 -0
- data/spec/models/get_public_holidays_request_spec.rb +47 -0
- data/spec/models/normalize_address_response_spec.rb +101 -0
- data/spec/models/public_holiday_occurrence_spec.rb +65 -0
- data/spec/models/public_holidays_response_spec.rb +47 -0
- metadata +29 -2
@@ -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
|
+
# Input parameter to a date time parsing request
|
17
|
+
class DateTimeStandardizedParseRequest
|
18
|
+
# Raw string input of a standard-formatted date and time for parsing
|
19
|
+
attr_accessor :raw_date_time_input
|
20
|
+
|
21
|
+
# Optional: specify the two-letter country code to optimzie date formatting; default is US
|
22
|
+
attr_accessor :country_code
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'raw_date_time_input' => :'RawDateTimeInput',
|
28
|
+
:'country_code' => :'CountryCode'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'raw_date_time_input' => :'String',
|
36
|
+
:'country_code' => :'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?(:'RawDateTimeInput')
|
49
|
+
self.raw_date_time_input = attributes[:'RawDateTimeInput']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'CountryCode')
|
53
|
+
self.country_code = attributes[:'CountryCode']
|
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
|
+
raw_date_time_input == o.raw_date_time_input &&
|
76
|
+
country_code == o.country_code
|
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
|
+
[raw_date_time_input, country_code].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,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
|
+
# Result of performing a date time parsing
|
17
|
+
class DateTimeStandardizedParseResponse
|
18
|
+
# True if successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# Result of performing a date time parsing
|
22
|
+
attr_accessor :parsed_date_result
|
23
|
+
|
24
|
+
# Year of the parsed date time result
|
25
|
+
attr_accessor :year
|
26
|
+
|
27
|
+
# Month of the parsed date time result
|
28
|
+
attr_accessor :month
|
29
|
+
|
30
|
+
# Day of the parsed date time result
|
31
|
+
attr_accessor :day
|
32
|
+
|
33
|
+
# Hour of the parsed date time result (24-hour)
|
34
|
+
attr_accessor :hour
|
35
|
+
|
36
|
+
# Minute of the parsed date time result
|
37
|
+
attr_accessor :minute
|
38
|
+
|
39
|
+
# Second of the parsed date time result
|
40
|
+
attr_accessor :second
|
41
|
+
|
42
|
+
# Day of week
|
43
|
+
attr_accessor :day_of_week
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'successful' => :'Successful',
|
49
|
+
:'parsed_date_result' => :'ParsedDateResult',
|
50
|
+
:'year' => :'Year',
|
51
|
+
:'month' => :'Month',
|
52
|
+
:'day' => :'Day',
|
53
|
+
:'hour' => :'Hour',
|
54
|
+
:'minute' => :'Minute',
|
55
|
+
:'second' => :'Second',
|
56
|
+
:'day_of_week' => :'DayOfWeek'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.swagger_types
|
62
|
+
{
|
63
|
+
:'successful' => :'BOOLEAN',
|
64
|
+
:'parsed_date_result' => :'DateTime',
|
65
|
+
:'year' => :'Integer',
|
66
|
+
:'month' => :'Integer',
|
67
|
+
:'day' => :'Integer',
|
68
|
+
:'hour' => :'Integer',
|
69
|
+
:'minute' => :'Integer',
|
70
|
+
:'second' => :'Integer',
|
71
|
+
:'day_of_week' => :'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?(:'Successful')
|
84
|
+
self.successful = attributes[:'Successful']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'ParsedDateResult')
|
88
|
+
self.parsed_date_result = attributes[:'ParsedDateResult']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'Year')
|
92
|
+
self.year = attributes[:'Year']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'Month')
|
96
|
+
self.month = attributes[:'Month']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'Day')
|
100
|
+
self.day = attributes[:'Day']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.has_key?(:'Hour')
|
104
|
+
self.hour = attributes[:'Hour']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'Minute')
|
108
|
+
self.minute = attributes[:'Minute']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'Second')
|
112
|
+
self.second = attributes[:'Second']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'DayOfWeek')
|
116
|
+
self.day_of_week = attributes[:'DayOfWeek']
|
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
|
+
successful == o.successful &&
|
139
|
+
parsed_date_result == o.parsed_date_result &&
|
140
|
+
year == o.year &&
|
141
|
+
month == o.month &&
|
142
|
+
day == o.day &&
|
143
|
+
hour == o.hour &&
|
144
|
+
minute == o.minute &&
|
145
|
+
second == o.second &&
|
146
|
+
day_of_week == o.day_of_week
|
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
|
+
[successful, parsed_date_result, year, month, day, hour, minute, second, day_of_week].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
|