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 country validation request
|
17
|
+
class GetPublicHolidaysRequest
|
18
|
+
# Two-letter code (FIPS 10-4 or ISO 3166-1) of the country; if not specified, defaults to United States
|
19
|
+
attr_accessor :raw_country_input
|
20
|
+
|
21
|
+
# Optional - the year in which to retrieve the holidays; if left blank (0) it will default to the current year
|
22
|
+
attr_accessor :year
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'raw_country_input' => :'RawCountryInput',
|
28
|
+
:'year' => :'Year'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'raw_country_input' => :'String',
|
36
|
+
:'year' => :'Integer'
|
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?(:'RawCountryInput')
|
49
|
+
self.raw_country_input = attributes[:'RawCountryInput']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'Year')
|
53
|
+
self.year = attributes[:'Year']
|
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_country_input == o.raw_country_input &&
|
76
|
+
year == o.year
|
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_country_input, year].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,286 @@
|
|
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 validating a street address
|
17
|
+
class NormalizeAddressResponse
|
18
|
+
# True if the address is valid, false otherwise
|
19
|
+
attr_accessor :valid_address
|
20
|
+
|
21
|
+
# The name of the building, house or structure if applicable, such as \"Cloudmersive Building 2\". This will often by null.
|
22
|
+
attr_accessor :building
|
23
|
+
|
24
|
+
# The street number or house number of the address. For example, in the address \"1600 Pennsylvania Avenue NW\" the street number would be \"1600\". This value will typically be populated for most addresses.
|
25
|
+
attr_accessor :street_number
|
26
|
+
|
27
|
+
# The name of the street or road of the address. For example, in the address \"1600 Pennsylvania Avenue NW\" the street number would be \"Pennsylvania Avenue NW\".
|
28
|
+
attr_accessor :street
|
29
|
+
|
30
|
+
# The city of the address.
|
31
|
+
attr_accessor :city
|
32
|
+
|
33
|
+
# The state or province of the address.
|
34
|
+
attr_accessor :state_or_province
|
35
|
+
|
36
|
+
# The postal code or zip code of the address.
|
37
|
+
attr_accessor :postal_code
|
38
|
+
|
39
|
+
# Country of the address, if present in the address. If not included in the address it will be null.
|
40
|
+
attr_accessor :country_full_name
|
41
|
+
|
42
|
+
# Two-letter ISO 3166-1 country code
|
43
|
+
attr_accessor :iso_two_letter_code
|
44
|
+
|
45
|
+
# If the address is valid, the degrees latitude of the validated address, null otherwise
|
46
|
+
attr_accessor :latitude
|
47
|
+
|
48
|
+
# If the address is valid, the degrees longitude of the validated address, null otherwise
|
49
|
+
attr_accessor :longitude
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'valid_address' => :'ValidAddress',
|
55
|
+
:'building' => :'Building',
|
56
|
+
:'street_number' => :'StreetNumber',
|
57
|
+
:'street' => :'Street',
|
58
|
+
:'city' => :'City',
|
59
|
+
:'state_or_province' => :'StateOrProvince',
|
60
|
+
:'postal_code' => :'PostalCode',
|
61
|
+
:'country_full_name' => :'CountryFullName',
|
62
|
+
:'iso_two_letter_code' => :'ISOTwoLetterCode',
|
63
|
+
:'latitude' => :'Latitude',
|
64
|
+
:'longitude' => :'Longitude'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.swagger_types
|
70
|
+
{
|
71
|
+
:'valid_address' => :'BOOLEAN',
|
72
|
+
:'building' => :'String',
|
73
|
+
:'street_number' => :'String',
|
74
|
+
:'street' => :'String',
|
75
|
+
:'city' => :'String',
|
76
|
+
:'state_or_province' => :'String',
|
77
|
+
:'postal_code' => :'String',
|
78
|
+
:'country_full_name' => :'String',
|
79
|
+
:'iso_two_letter_code' => :'String',
|
80
|
+
:'latitude' => :'Float',
|
81
|
+
:'longitude' => :'Float'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
def initialize(attributes = {})
|
88
|
+
return unless attributes.is_a?(Hash)
|
89
|
+
|
90
|
+
# convert string to symbol for hash key
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
92
|
+
|
93
|
+
if attributes.has_key?(:'ValidAddress')
|
94
|
+
self.valid_address = attributes[:'ValidAddress']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'Building')
|
98
|
+
self.building = attributes[:'Building']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'StreetNumber')
|
102
|
+
self.street_number = attributes[:'StreetNumber']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'Street')
|
106
|
+
self.street = attributes[:'Street']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'City')
|
110
|
+
self.city = attributes[:'City']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'StateOrProvince')
|
114
|
+
self.state_or_province = attributes[:'StateOrProvince']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'PostalCode')
|
118
|
+
self.postal_code = attributes[:'PostalCode']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'CountryFullName')
|
122
|
+
self.country_full_name = attributes[:'CountryFullName']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'ISOTwoLetterCode')
|
126
|
+
self.iso_two_letter_code = attributes[:'ISOTwoLetterCode']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'Latitude')
|
130
|
+
self.latitude = attributes[:'Latitude']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'Longitude')
|
134
|
+
self.longitude = attributes[:'Longitude']
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
139
|
+
# @return Array for valid properties with the reasons
|
140
|
+
def list_invalid_properties
|
141
|
+
invalid_properties = Array.new
|
142
|
+
invalid_properties
|
143
|
+
end
|
144
|
+
|
145
|
+
# Check to see if the all the properties in the model are valid
|
146
|
+
# @return true if the model is valid
|
147
|
+
def valid?
|
148
|
+
true
|
149
|
+
end
|
150
|
+
|
151
|
+
# Checks equality by comparing each attribute.
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def ==(o)
|
154
|
+
return true if self.equal?(o)
|
155
|
+
self.class == o.class &&
|
156
|
+
valid_address == o.valid_address &&
|
157
|
+
building == o.building &&
|
158
|
+
street_number == o.street_number &&
|
159
|
+
street == o.street &&
|
160
|
+
city == o.city &&
|
161
|
+
state_or_province == o.state_or_province &&
|
162
|
+
postal_code == o.postal_code &&
|
163
|
+
country_full_name == o.country_full_name &&
|
164
|
+
iso_two_letter_code == o.iso_two_letter_code &&
|
165
|
+
latitude == o.latitude &&
|
166
|
+
longitude == o.longitude
|
167
|
+
end
|
168
|
+
|
169
|
+
# @see the `==` method
|
170
|
+
# @param [Object] Object to be compared
|
171
|
+
def eql?(o)
|
172
|
+
self == o
|
173
|
+
end
|
174
|
+
|
175
|
+
# Calculates hash code according to all attributes.
|
176
|
+
# @return [Fixnum] Hash code
|
177
|
+
def hash
|
178
|
+
[valid_address, building, street_number, street, city, state_or_province, postal_code, country_full_name, iso_two_letter_code, latitude, longitude].hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Builds the object from hash
|
182
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
183
|
+
# @return [Object] Returns the model itself
|
184
|
+
def build_from_hash(attributes)
|
185
|
+
return nil unless attributes.is_a?(Hash)
|
186
|
+
self.class.swagger_types.each_pair do |key, type|
|
187
|
+
if type =~ /\AArray<(.*)>/i
|
188
|
+
# check to ensure the input is an array given that the attribute
|
189
|
+
# is documented as an array but the input is not
|
190
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
191
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
192
|
+
end
|
193
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
194
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
195
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
196
|
+
end
|
197
|
+
|
198
|
+
self
|
199
|
+
end
|
200
|
+
|
201
|
+
# Deserializes the data based on type
|
202
|
+
# @param string type Data type
|
203
|
+
# @param string value Value to be deserialized
|
204
|
+
# @return [Object] Deserialized data
|
205
|
+
def _deserialize(type, value)
|
206
|
+
case type.to_sym
|
207
|
+
when :DateTime
|
208
|
+
DateTime.parse(value)
|
209
|
+
when :Date
|
210
|
+
Date.parse(value)
|
211
|
+
when :String
|
212
|
+
value.to_s
|
213
|
+
when :Integer
|
214
|
+
value.to_i
|
215
|
+
when :Float
|
216
|
+
value.to_f
|
217
|
+
when :BOOLEAN
|
218
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
219
|
+
true
|
220
|
+
else
|
221
|
+
false
|
222
|
+
end
|
223
|
+
when :Object
|
224
|
+
# generic object (usually a Hash), return directly
|
225
|
+
value
|
226
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
227
|
+
inner_type = Regexp.last_match[:inner_type]
|
228
|
+
value.map { |v| _deserialize(inner_type, v) }
|
229
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
230
|
+
k_type = Regexp.last_match[:k_type]
|
231
|
+
v_type = Regexp.last_match[:v_type]
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each do |k, v|
|
234
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
else # model
|
238
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
239
|
+
temp_model.build_from_hash(value)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the string representation of the object
|
244
|
+
# @return [String] String presentation of the object
|
245
|
+
def to_s
|
246
|
+
to_hash.to_s
|
247
|
+
end
|
248
|
+
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_body
|
252
|
+
to_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the object in the form of hash
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
257
|
+
def to_hash
|
258
|
+
hash = {}
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
260
|
+
value = self.send(attr)
|
261
|
+
next if value.nil?
|
262
|
+
hash[param] = _to_hash(value)
|
263
|
+
end
|
264
|
+
hash
|
265
|
+
end
|
266
|
+
|
267
|
+
# Outputs non-array value in the form of hash
|
268
|
+
# For object, use to_hash. Otherwise, just return the value
|
269
|
+
# @param [Object] value Any valid value
|
270
|
+
# @return [Hash] Returns the value in the form of hash
|
271
|
+
def _to_hash(value)
|
272
|
+
if value.is_a?(Array)
|
273
|
+
value.compact.map { |v| _to_hash(v) }
|
274
|
+
elsif value.is_a?(Hash)
|
275
|
+
{}.tap do |hash|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
277
|
+
end
|
278
|
+
elsif value.respond_to? :to_hash
|
279
|
+
value.to_hash
|
280
|
+
else
|
281
|
+
value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
286
|
+
end
|