ipgeolocation_sdk 1.0.0

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 (218) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +2124 -0
  5. data/Rakefile +10 -0
  6. data/docs/ASNConnection.md +22 -0
  7. data/docs/ASNDetails.md +48 -0
  8. data/docs/ASNLookupApi.md +89 -0
  9. data/docs/ASNResponse.md +20 -0
  10. data/docs/ASNResponseXML.md +20 -0
  11. data/docs/ASNResponseXMLAsn.md +48 -0
  12. data/docs/Abuse.md +40 -0
  13. data/docs/AbuseContactApi.md +85 -0
  14. data/docs/AbuseResponse.md +20 -0
  15. data/docs/AbuseResponseXML.md +20 -0
  16. data/docs/Astronomy.md +68 -0
  17. data/docs/AstronomyApi.md +97 -0
  18. data/docs/AstronomyEvening.md +36 -0
  19. data/docs/AstronomyLocation.md +50 -0
  20. data/docs/AstronomyMorning.md +36 -0
  21. data/docs/AstronomyResponse.md +22 -0
  22. data/docs/AstronomyXMLResponse.md +22 -0
  23. data/docs/BulkIPGeolocation.md +42 -0
  24. data/docs/BulkIPSecurity.md +42 -0
  25. data/docs/CountryMetadata.md +22 -0
  26. data/docs/Currency.md +22 -0
  27. data/docs/ErrorResponse.md +18 -0
  28. data/docs/ErrorXMLResponse.md +18 -0
  29. data/docs/ErrorXMLResponseArray.md +18 -0
  30. data/docs/GeolocationResponse.md +38 -0
  31. data/docs/GeolocationXMLResponse.md +38 -0
  32. data/docs/GeolocationXMLResponseArray.md +38 -0
  33. data/docs/GetBulkIpGeolocation200ResponseInner1.md +49 -0
  34. data/docs/GetBulkIpGeolocationRequest.md +18 -0
  35. data/docs/GetBulkIpSecurityInfo200ResponseInner1.md +49 -0
  36. data/docs/IPLocationApi.md +175 -0
  37. data/docs/Location.md +58 -0
  38. data/docs/LocationMinimal.md +52 -0
  39. data/docs/Network.md +22 -0
  40. data/docs/NetworkAsn.md +38 -0
  41. data/docs/NetworkCompany.md +22 -0
  42. data/docs/NetworkMinimal.md +20 -0
  43. data/docs/NetworkMinimalAsn.md +22 -0
  44. data/docs/NetworkMinimalCompany.md +18 -0
  45. data/docs/ParseBulkUserAgentStringsRequest.md +18 -0
  46. data/docs/ParseUserAgentStringRequest.md +18 -0
  47. data/docs/Security.md +38 -0
  48. data/docs/SecurityAPIResponse.md +34 -0
  49. data/docs/SecurityAPIXMLResponse.md +34 -0
  50. data/docs/SecurityAPIXMLResponseArray.md +34 -0
  51. data/docs/SecurityApi.md +175 -0
  52. data/docs/TimeConversionApi.md +109 -0
  53. data/docs/TimeConversionResponse.md +24 -0
  54. data/docs/TimeConversionXMLResponse.md +24 -0
  55. data/docs/TimeZone.md +36 -0
  56. data/docs/TimeZoneDetailedResponse.md +26 -0
  57. data/docs/TimeZoneDetailedXMLResponse.md +26 -0
  58. data/docs/TimeZoneDstEnd.md +28 -0
  59. data/docs/TimeZoneDstStart.md +28 -0
  60. data/docs/TimezoneAirport.md +40 -0
  61. data/docs/TimezoneApi.md +99 -0
  62. data/docs/TimezoneDetail.md +56 -0
  63. data/docs/TimezoneDetailDstEnd.md +28 -0
  64. data/docs/TimezoneDetailDstStart.md +28 -0
  65. data/docs/TimezoneLocation.md +48 -0
  66. data/docs/TimezoneLocode.md +32 -0
  67. data/docs/UserAgentApi.md +235 -0
  68. data/docs/UserAgentData.md +32 -0
  69. data/docs/UserAgentDataDevice.md +24 -0
  70. data/docs/UserAgentDataEngine.md +24 -0
  71. data/docs/UserAgentDataOperatingSystem.md +26 -0
  72. data/docs/UserAgentXMLData.md +32 -0
  73. data/docs/UserAgentXMLDataArray.md +32 -0
  74. data/git_push.sh +57 -0
  75. data/ipgeolocation_sdk.gemspec +29 -0
  76. data/lib/ipgeolocation_sdk/api/abuse_contact_api.rb +86 -0
  77. data/lib/ipgeolocation_sdk/api/asn_lookup_api.rb +92 -0
  78. data/lib/ipgeolocation_sdk/api/astronomy_api.rb +116 -0
  79. data/lib/ipgeolocation_sdk/api/ip_geolocation_api.rb +186 -0
  80. data/lib/ipgeolocation_sdk/api/ip_security_api.rb +184 -0
  81. data/lib/ipgeolocation_sdk/api/time_conversion_api.rb +122 -0
  82. data/lib/ipgeolocation_sdk/api/timezone_api.rb +113 -0
  83. data/lib/ipgeolocation_sdk/api/user_agent_api.rb +158 -0
  84. data/lib/ipgeolocation_sdk/api_client.rb +393 -0
  85. data/lib/ipgeolocation_sdk/api_error.rb +58 -0
  86. data/lib/ipgeolocation_sdk/configuration.rb +308 -0
  87. data/lib/ipgeolocation_sdk/models/abuse.rb +305 -0
  88. data/lib/ipgeolocation_sdk/models/abuse_response.rb +229 -0
  89. data/lib/ipgeolocation_sdk/models/abuse_response_xml.rb +229 -0
  90. data/lib/ipgeolocation_sdk/models/asn_connection.rb +238 -0
  91. data/lib/ipgeolocation_sdk/models/asn_response.rb +230 -0
  92. data/lib/ipgeolocation_sdk/models/asn_response_asn.rb +368 -0
  93. data/lib/ipgeolocation_sdk/models/asn_response_xml.rb +229 -0
  94. data/lib/ipgeolocation_sdk/models/asn_response_xml_asn.rb +364 -0
  95. data/lib/ipgeolocation_sdk/models/astronomy.rb +445 -0
  96. data/lib/ipgeolocation_sdk/models/astronomy_evening.rb +301 -0
  97. data/lib/ipgeolocation_sdk/models/astronomy_location.rb +364 -0
  98. data/lib/ipgeolocation_sdk/models/astronomy_morning.rb +301 -0
  99. data/lib/ipgeolocation_sdk/models/astronomy_response.rb +238 -0
  100. data/lib/ipgeolocation_sdk/models/astronomy_xml_response.rb +238 -0
  101. data/lib/ipgeolocation_sdk/models/bulk_ip_geolocation.rb +113 -0
  102. data/lib/ipgeolocation_sdk/models/bulk_ip_security.rb +113 -0
  103. data/lib/ipgeolocation_sdk/models/country_metadata.rb +240 -0
  104. data/lib/ipgeolocation_sdk/models/currency.rb +238 -0
  105. data/lib/ipgeolocation_sdk/models/error_response.rb +220 -0
  106. data/lib/ipgeolocation_sdk/models/error_xml_response.rb +220 -0
  107. data/lib/ipgeolocation_sdk/models/error_xml_response_array.rb +220 -0
  108. data/lib/ipgeolocation_sdk/models/geolocation_response.rb +310 -0
  109. data/lib/ipgeolocation_sdk/models/geolocation_xml_response.rb +310 -0
  110. data/lib/ipgeolocation_sdk/models/geolocation_xml_response_array.rb +310 -0
  111. data/lib/ipgeolocation_sdk/models/get_bulk_ip_geolocation200_response_inner1.rb +105 -0
  112. data/lib/ipgeolocation_sdk/models/get_bulk_ip_geolocation_request.rb +241 -0
  113. data/lib/ipgeolocation_sdk/models/get_bulk_ip_security_info200_response_inner1.rb +105 -0
  114. data/lib/ipgeolocation_sdk/models/location.rb +400 -0
  115. data/lib/ipgeolocation_sdk/models/location_minimal.rb +373 -0
  116. data/lib/ipgeolocation_sdk/models/network.rb +238 -0
  117. data/lib/ipgeolocation_sdk/models/network_asn.rb +310 -0
  118. data/lib/ipgeolocation_sdk/models/network_company.rb +238 -0
  119. data/lib/ipgeolocation_sdk/models/network_minimal.rb +229 -0
  120. data/lib/ipgeolocation_sdk/models/network_minimal_asn.rb +238 -0
  121. data/lib/ipgeolocation_sdk/models/network_minimal_company.rb +220 -0
  122. data/lib/ipgeolocation_sdk/models/parse_bulk_user_agent_strings_request.rb +222 -0
  123. data/lib/ipgeolocation_sdk/models/parse_user_agent_string_request.rb +220 -0
  124. data/lib/ipgeolocation_sdk/models/security.rb +310 -0
  125. data/lib/ipgeolocation_sdk/models/security_api_response.rb +292 -0
  126. data/lib/ipgeolocation_sdk/models/security_apixml_response.rb +292 -0
  127. data/lib/ipgeolocation_sdk/models/security_apixml_response_array.rb +292 -0
  128. data/lib/ipgeolocation_sdk/models/time_conversion_response.rb +247 -0
  129. data/lib/ipgeolocation_sdk/models/time_conversion_xml_response.rb +247 -0
  130. data/lib/ipgeolocation_sdk/models/time_zone.rb +301 -0
  131. data/lib/ipgeolocation_sdk/models/time_zone_detailed_response.rb +256 -0
  132. data/lib/ipgeolocation_sdk/models/time_zone_detailed_xml_response.rb +256 -0
  133. data/lib/ipgeolocation_sdk/models/time_zone_dst_end.rb +265 -0
  134. data/lib/ipgeolocation_sdk/models/time_zone_dst_start.rb +265 -0
  135. data/lib/ipgeolocation_sdk/models/timezone_airport.rb +319 -0
  136. data/lib/ipgeolocation_sdk/models/timezone_detail.rb +391 -0
  137. data/lib/ipgeolocation_sdk/models/timezone_detail_dst_end.rb +265 -0
  138. data/lib/ipgeolocation_sdk/models/timezone_detail_dst_start.rb +265 -0
  139. data/lib/ipgeolocation_sdk/models/timezone_location.rb +355 -0
  140. data/lib/ipgeolocation_sdk/models/timezone_locode.rb +283 -0
  141. data/lib/ipgeolocation_sdk/models/user_agent_data.rb +283 -0
  142. data/lib/ipgeolocation_sdk/models/user_agent_data_device.rb +247 -0
  143. data/lib/ipgeolocation_sdk/models/user_agent_data_engine.rb +247 -0
  144. data/lib/ipgeolocation_sdk/models/user_agent_data_operating_system.rb +256 -0
  145. data/lib/ipgeolocation_sdk/models/user_agent_xml_data.rb +283 -0
  146. data/lib/ipgeolocation_sdk/models/user_agent_xml_data_array.rb +283 -0
  147. data/lib/ipgeolocation_sdk/version.rb +15 -0
  148. data/lib/ipgeolocation_sdk.rb +107 -0
  149. data/spec/api/abuse_contact_api_spec.rb +48 -0
  150. data/spec/api/asn_lookup_api_spec.rb +50 -0
  151. data/spec/api/astronomy_api_spec.rb +54 -0
  152. data/spec/api/ip_location_api_spec.rb +67 -0
  153. data/spec/api/security_api_spec.rb +67 -0
  154. data/spec/api/time_conversion_api_spec.rb +60 -0
  155. data/spec/api/timezone_api_spec.rb +56 -0
  156. data/spec/api/user_agent_api_spec.rb +74 -0
  157. data/spec/models/abuse_response_spec.rb +42 -0
  158. data/spec/models/abuse_response_xml_spec.rb +42 -0
  159. data/spec/models/abuse_spec.rb +90 -0
  160. data/spec/models/asn_connection_spec.rb +48 -0
  161. data/spec/models/asn_response_asn_spec.rb +126 -0
  162. data/spec/models/asn_response_spec.rb +42 -0
  163. data/spec/models/asn_response_xml_asn_spec.rb +126 -0
  164. data/spec/models/asn_response_xml_spec.rb +42 -0
  165. data/spec/models/astronomy_evening_spec.rb +90 -0
  166. data/spec/models/astronomy_location_spec.rb +132 -0
  167. data/spec/models/astronomy_morning_spec.rb +90 -0
  168. data/spec/models/astronomy_response_spec.rb +48 -0
  169. data/spec/models/astronomy_spec.rb +186 -0
  170. data/spec/models/astronomy_xml_response_spec.rb +48 -0
  171. data/spec/models/country_metadata_spec.rb +48 -0
  172. data/spec/models/currency_spec.rb +48 -0
  173. data/spec/models/error_response_spec.rb +36 -0
  174. data/spec/models/error_xml_response_array_spec.rb +36 -0
  175. data/spec/models/error_xml_response_spec.rb +36 -0
  176. data/spec/models/geolocation_response_spec.rb +96 -0
  177. data/spec/models/geolocation_xml_response_array_spec.rb +96 -0
  178. data/spec/models/geolocation_xml_response_spec.rb +96 -0
  179. data/spec/models/get_bulk_ip_geolocation200_response_inner1_spec.rb +32 -0
  180. data/spec/models/get_bulk_ip_geolocation200_response_inner_spec.rb +32 -0
  181. data/spec/models/get_bulk_ip_geolocation_request_spec.rb +36 -0
  182. data/spec/models/get_bulk_ip_security_info200_response_inner1_spec.rb +32 -0
  183. data/spec/models/get_bulk_ip_security_info200_response_inner_spec.rb +32 -0
  184. data/spec/models/location_minimal_spec.rb +138 -0
  185. data/spec/models/location_spec.rb +156 -0
  186. data/spec/models/network_asn_spec.rb +96 -0
  187. data/spec/models/network_company_spec.rb +48 -0
  188. data/spec/models/network_minimal_asn_spec.rb +48 -0
  189. data/spec/models/network_minimal_company_spec.rb +36 -0
  190. data/spec/models/network_minimal_spec.rb +42 -0
  191. data/spec/models/network_spec.rb +48 -0
  192. data/spec/models/parse_bulk_user_agent_strings_request_spec.rb +36 -0
  193. data/spec/models/parse_user_agent_string_request_spec.rb +36 -0
  194. data/spec/models/security_api_response_spec.rb +84 -0
  195. data/spec/models/security_apixml_response_array_spec.rb +84 -0
  196. data/spec/models/security_apixml_response_spec.rb +84 -0
  197. data/spec/models/security_spec.rb +96 -0
  198. data/spec/models/time_conversion_response_spec.rb +54 -0
  199. data/spec/models/time_conversion_xml_response_spec.rb +54 -0
  200. data/spec/models/time_zone_detailed_response_spec.rb +60 -0
  201. data/spec/models/time_zone_detailed_xml_response_spec.rb +60 -0
  202. data/spec/models/time_zone_dst_end_spec.rb +66 -0
  203. data/spec/models/time_zone_dst_start_spec.rb +66 -0
  204. data/spec/models/time_zone_spec.rb +90 -0
  205. data/spec/models/timezone_airport_spec.rb +102 -0
  206. data/spec/models/timezone_detail_dst_end_spec.rb +66 -0
  207. data/spec/models/timezone_detail_dst_start_spec.rb +66 -0
  208. data/spec/models/timezone_detail_spec.rb +150 -0
  209. data/spec/models/timezone_location_spec.rb +126 -0
  210. data/spec/models/timezone_locode_spec.rb +78 -0
  211. data/spec/models/user_agent_data_device_spec.rb +54 -0
  212. data/spec/models/user_agent_data_engine_spec.rb +54 -0
  213. data/spec/models/user_agent_data_operating_system_spec.rb +60 -0
  214. data/spec/models/user_agent_data_spec.rb +78 -0
  215. data/spec/models/user_agent_xml_data_array_spec.rb +78 -0
  216. data/spec/models/user_agent_xml_data_spec.rb +78 -0
  217. data/spec/spec_helper.rb +111 -0
  218. metadata +373 -0
@@ -0,0 +1,310 @@
1
+ =begin
2
+ #IPGeolocation.io - IP intelligence products
3
+
4
+ #Ipgeolocation provides a set of APIs to make ip based decisions.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IpgeolocationSdk
17
+ class GeolocationXMLResponse
18
+ attr_accessor :ip
19
+
20
+ attr_accessor :hostname
21
+
22
+ attr_accessor :domain
23
+
24
+ attr_accessor :location
25
+
26
+ attr_accessor :country_metadata
27
+
28
+ attr_accessor :network
29
+
30
+ attr_accessor :currency
31
+
32
+ attr_accessor :security
33
+
34
+ attr_accessor :abuse
35
+
36
+ attr_accessor :time_zone
37
+
38
+ attr_accessor :user_agent
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'ip' => :'ip',
44
+ :'hostname' => :'hostname',
45
+ :'domain' => :'domain',
46
+ :'location' => :'location',
47
+ :'country_metadata' => :'country_metadata',
48
+ :'network' => :'network',
49
+ :'currency' => :'currency',
50
+ :'security' => :'security',
51
+ :'abuse' => :'abuse',
52
+ :'time_zone' => :'time_zone',
53
+ :'user_agent' => :'user_agent'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'ip' => :'String',
71
+ :'hostname' => :'String',
72
+ :'domain' => :'String',
73
+ :'location' => :'Location',
74
+ :'country_metadata' => :'CountryMetadata',
75
+ :'network' => :'Network',
76
+ :'currency' => :'Currency',
77
+ :'security' => :'Security',
78
+ :'abuse' => :'Abuse',
79
+ :'time_zone' => :'TimeZone',
80
+ :'user_agent' => :'UserAgentData'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IpgeolocationSdk::GeolocationXMLResponse` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IpgeolocationSdk::GeolocationXMLResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'ip')
107
+ self.ip = attributes[:'ip']
108
+ end
109
+
110
+ if attributes.key?(:'hostname')
111
+ self.hostname = attributes[:'hostname']
112
+ end
113
+
114
+ if attributes.key?(:'domain')
115
+ self.domain = attributes[:'domain']
116
+ end
117
+
118
+ if attributes.key?(:'location')
119
+ self.location = attributes[:'location']
120
+ end
121
+
122
+ if attributes.key?(:'country_metadata')
123
+ self.country_metadata = attributes[:'country_metadata']
124
+ end
125
+
126
+ if attributes.key?(:'network')
127
+ self.network = attributes[:'network']
128
+ end
129
+
130
+ if attributes.key?(:'currency')
131
+ self.currency = attributes[:'currency']
132
+ end
133
+
134
+ if attributes.key?(:'security')
135
+ self.security = attributes[:'security']
136
+ end
137
+
138
+ if attributes.key?(:'abuse')
139
+ self.abuse = attributes[:'abuse']
140
+ end
141
+
142
+ if attributes.key?(:'time_zone')
143
+ self.time_zone = attributes[:'time_zone']
144
+ end
145
+
146
+ if attributes.key?(:'user_agent')
147
+ self.user_agent = attributes[:'user_agent']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ true
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ ip == o.ip &&
172
+ hostname == o.hostname &&
173
+ domain == o.domain &&
174
+ location == o.location &&
175
+ country_metadata == o.country_metadata &&
176
+ network == o.network &&
177
+ currency == o.currency &&
178
+ security == o.security &&
179
+ abuse == o.abuse &&
180
+ time_zone == o.time_zone &&
181
+ user_agent == o.user_agent
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [ip, hostname, domain, location, country_metadata, network, currency, security, abuse, time_zone, user_agent].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ attributes = attributes.transform_keys(&:to_sym)
202
+ transformed_hash = {}
203
+ openapi_types.each_pair do |key, type|
204
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = nil
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[attribute_map[key]].is_a?(Array)
210
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
211
+ end
212
+ elsif !attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
214
+ end
215
+ end
216
+ new(transformed_hash)
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def self._deserialize(type, value)
224
+ case type.to_sym
225
+ when :Time
226
+ Time.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ # models (e.g. Pet) or oneOf
257
+ klass = IpgeolocationSdk.const_get(type)
258
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
259
+ end
260
+ end
261
+
262
+ # Returns the string representation of the object
263
+ # @return [String] String presentation of the object
264
+ def to_s
265
+ to_hash.to_s
266
+ end
267
+
268
+ # to_body is an alias to to_hash (backward compatibility)
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_body
271
+ to_hash
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ if value.nil?
281
+ is_nullable = self.class.openapi_nullable.include?(attr)
282
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
283
+ end
284
+
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ # Outputs non-array value in the form of hash
291
+ # For object, use to_hash. Otherwise, just return the value
292
+ # @param [Object] value Any valid value
293
+ # @return [Hash] Returns the value in the form of hash
294
+ def _to_hash(value)
295
+ if value.is_a?(Array)
296
+ value.compact.map { |v| _to_hash(v) }
297
+ elsif value.is_a?(Hash)
298
+ {}.tap do |hash|
299
+ value.each { |k, v| hash[k] = _to_hash(v) }
300
+ end
301
+ elsif value.respond_to? :to_hash
302
+ value.to_hash
303
+ else
304
+ value
305
+ end
306
+ end
307
+
308
+ end
309
+
310
+ end
@@ -0,0 +1,310 @@
1
+ =begin
2
+ #IPGeolocation.io - IP intelligence products
3
+
4
+ #Ipgeolocation provides a set of APIs to make ip based decisions.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IpgeolocationSdk
17
+ class GeolocationXMLResponseArray
18
+ attr_accessor :ip
19
+
20
+ attr_accessor :hostname
21
+
22
+ attr_accessor :domain
23
+
24
+ attr_accessor :location
25
+
26
+ attr_accessor :country_metadata
27
+
28
+ attr_accessor :network
29
+
30
+ attr_accessor :currency
31
+
32
+ attr_accessor :security
33
+
34
+ attr_accessor :abuse
35
+
36
+ attr_accessor :time_zone
37
+
38
+ attr_accessor :user_agent
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'ip' => :'ip',
44
+ :'hostname' => :'hostname',
45
+ :'domain' => :'domain',
46
+ :'location' => :'location',
47
+ :'country_metadata' => :'country_metadata',
48
+ :'network' => :'network',
49
+ :'currency' => :'currency',
50
+ :'security' => :'security',
51
+ :'abuse' => :'abuse',
52
+ :'time_zone' => :'time_zone',
53
+ :'user_agent' => :'user_agent'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'ip' => :'String',
71
+ :'hostname' => :'String',
72
+ :'domain' => :'String',
73
+ :'location' => :'Location',
74
+ :'country_metadata' => :'CountryMetadata',
75
+ :'network' => :'Network',
76
+ :'currency' => :'Currency',
77
+ :'security' => :'Security',
78
+ :'abuse' => :'Abuse',
79
+ :'time_zone' => :'TimeZone',
80
+ :'user_agent' => :'UserAgentData'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IpgeolocationSdk::GeolocationXMLResponseArray` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IpgeolocationSdk::GeolocationXMLResponseArray`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'ip')
107
+ self.ip = attributes[:'ip']
108
+ end
109
+
110
+ if attributes.key?(:'hostname')
111
+ self.hostname = attributes[:'hostname']
112
+ end
113
+
114
+ if attributes.key?(:'domain')
115
+ self.domain = attributes[:'domain']
116
+ end
117
+
118
+ if attributes.key?(:'location')
119
+ self.location = attributes[:'location']
120
+ end
121
+
122
+ if attributes.key?(:'country_metadata')
123
+ self.country_metadata = attributes[:'country_metadata']
124
+ end
125
+
126
+ if attributes.key?(:'network')
127
+ self.network = attributes[:'network']
128
+ end
129
+
130
+ if attributes.key?(:'currency')
131
+ self.currency = attributes[:'currency']
132
+ end
133
+
134
+ if attributes.key?(:'security')
135
+ self.security = attributes[:'security']
136
+ end
137
+
138
+ if attributes.key?(:'abuse')
139
+ self.abuse = attributes[:'abuse']
140
+ end
141
+
142
+ if attributes.key?(:'time_zone')
143
+ self.time_zone = attributes[:'time_zone']
144
+ end
145
+
146
+ if attributes.key?(:'user_agent')
147
+ self.user_agent = attributes[:'user_agent']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ true
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ ip == o.ip &&
172
+ hostname == o.hostname &&
173
+ domain == o.domain &&
174
+ location == o.location &&
175
+ country_metadata == o.country_metadata &&
176
+ network == o.network &&
177
+ currency == o.currency &&
178
+ security == o.security &&
179
+ abuse == o.abuse &&
180
+ time_zone == o.time_zone &&
181
+ user_agent == o.user_agent
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [ip, hostname, domain, location, country_metadata, network, currency, security, abuse, time_zone, user_agent].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ attributes = attributes.transform_keys(&:to_sym)
202
+ transformed_hash = {}
203
+ openapi_types.each_pair do |key, type|
204
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = nil
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[attribute_map[key]].is_a?(Array)
210
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
211
+ end
212
+ elsif !attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
214
+ end
215
+ end
216
+ new(transformed_hash)
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def self._deserialize(type, value)
224
+ case type.to_sym
225
+ when :Time
226
+ Time.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ # models (e.g. Pet) or oneOf
257
+ klass = IpgeolocationSdk.const_get(type)
258
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
259
+ end
260
+ end
261
+
262
+ # Returns the string representation of the object
263
+ # @return [String] String presentation of the object
264
+ def to_s
265
+ to_hash.to_s
266
+ end
267
+
268
+ # to_body is an alias to to_hash (backward compatibility)
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_body
271
+ to_hash
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ if value.nil?
281
+ is_nullable = self.class.openapi_nullable.include?(attr)
282
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
283
+ end
284
+
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ # Outputs non-array value in the form of hash
291
+ # For object, use to_hash. Otherwise, just return the value
292
+ # @param [Object] value Any valid value
293
+ # @return [Hash] Returns the value in the form of hash
294
+ def _to_hash(value)
295
+ if value.is_a?(Array)
296
+ value.compact.map { |v| _to_hash(v) }
297
+ elsif value.is_a?(Hash)
298
+ {}.tap do |hash|
299
+ value.each { |k, v| hash[k] = _to_hash(v) }
300
+ end
301
+ elsif value.respond_to? :to_hash
302
+ value.to_hash
303
+ else
304
+ value
305
+ end
306
+ end
307
+
308
+ end
309
+
310
+ end