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,230 @@
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 ASNResponse
18
+ # IP address for which ASN information is returned. Present if the 'ip' query parameter is used or no IP is specified (defaults to requester's IP).
19
+ attr_accessor :ip
20
+
21
+ attr_accessor :asn
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'ip' => :'ip',
27
+ :'asn' => :'asn'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'ip' => :'String',
45
+ :'asn' => :'ASNDetails'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IpgeolocationSdk::ASNResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IpgeolocationSdk::ASNResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'ip')
72
+ self.ip = attributes[:'ip']
73
+ end
74
+
75
+ if attributes.key?(:'asn')
76
+ self.asn = attributes[:'asn']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ ip == o.ip &&
101
+ asn == o.asn
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [ip, asn].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ transformed_hash = {}
123
+ openapi_types.each_pair do |key, type|
124
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = nil
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[attribute_map[key]].is_a?(Array)
130
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def self._deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = IpgeolocationSdk.const_get(type)
178
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -0,0 +1,368 @@
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 ASNDetails
18
+ attr_accessor :as_number
19
+
20
+ attr_accessor :organization
21
+
22
+ attr_accessor :country
23
+
24
+ attr_accessor :asn_name
25
+
26
+ attr_accessor :type
27
+
28
+ attr_accessor :domain
29
+
30
+ attr_accessor :date_allocated
31
+
32
+ attr_accessor :allocation_status
33
+
34
+ attr_accessor :num_of_ipv4_routes
35
+
36
+ attr_accessor :num_of_ipv6_routes
37
+
38
+ attr_accessor :rir
39
+
40
+ # It will only be included in the response, if you set include=routes in the request
41
+ attr_accessor :routes
42
+
43
+ # It will only be included in the response, if you set include=upstreams in the request
44
+ attr_accessor :upstreams
45
+
46
+ # It will only be included in the response, if you set include=downstreams in the request
47
+ attr_accessor :downstreams
48
+
49
+ # It will only be included in the response, if you set include=peers in the request
50
+ attr_accessor :peers
51
+
52
+ # It will only be included in the response, if you set include=whois_response in the request
53
+ attr_accessor :whois_response
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'as_number' => :'as_number',
59
+ :'organization' => :'organization',
60
+ :'country' => :'country',
61
+ :'asn_name' => :'asn_name',
62
+ :'type' => :'type',
63
+ :'domain' => :'domain',
64
+ :'date_allocated' => :'date_allocated',
65
+ :'allocation_status' => :'allocation_status',
66
+ :'num_of_ipv4_routes' => :'num_of_ipv4_routes',
67
+ :'num_of_ipv6_routes' => :'num_of_ipv6_routes',
68
+ :'rir' => :'rir',
69
+ :'routes' => :'routes',
70
+ :'upstreams' => :'upstreams',
71
+ :'downstreams' => :'downstreams',
72
+ :'peers' => :'peers',
73
+ :'whois_response' => :'whois_response'
74
+ }
75
+ end
76
+
77
+ # Returns attribute mapping this model knows about
78
+ def self.acceptable_attribute_map
79
+ attribute_map
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ acceptable_attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'as_number' => :'String',
91
+ :'organization' => :'String',
92
+ :'country' => :'String',
93
+ :'asn_name' => :'String',
94
+ :'type' => :'String',
95
+ :'domain' => :'String',
96
+ :'date_allocated' => :'String',
97
+ :'allocation_status' => :'String',
98
+ :'num_of_ipv4_routes' => :'String',
99
+ :'num_of_ipv6_routes' => :'String',
100
+ :'rir' => :'String',
101
+ :'routes' => :'Array<String>',
102
+ :'upstreams' => :'Array<ASNConnection>',
103
+ :'downstreams' => :'Array<ASNConnection>',
104
+ :'peers' => :'Array<ASNConnection>',
105
+ :'whois_response' => :'String'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IpgeolocationSdk::ASNResponseAsn` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ acceptable_attribute_map = self.class.acceptable_attribute_map
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!acceptable_attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IpgeolocationSdk::ASNResponseAsn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'as_number')
132
+ self.as_number = attributes[:'as_number']
133
+ end
134
+
135
+ if attributes.key?(:'organization')
136
+ self.organization = attributes[:'organization']
137
+ end
138
+
139
+ if attributes.key?(:'country')
140
+ self.country = attributes[:'country']
141
+ end
142
+
143
+ if attributes.key?(:'asn_name')
144
+ self.asn_name = attributes[:'asn_name']
145
+ end
146
+
147
+ if attributes.key?(:'type')
148
+ self.type = attributes[:'type']
149
+ end
150
+
151
+ if attributes.key?(:'domain')
152
+ self.domain = attributes[:'domain']
153
+ end
154
+
155
+ if attributes.key?(:'date_allocated')
156
+ self.date_allocated = attributes[:'date_allocated']
157
+ end
158
+
159
+ if attributes.key?(:'allocation_status')
160
+ self.allocation_status = attributes[:'allocation_status']
161
+ end
162
+
163
+ if attributes.key?(:'num_of_ipv4_routes')
164
+ self.num_of_ipv4_routes = attributes[:'num_of_ipv4_routes']
165
+ end
166
+
167
+ if attributes.key?(:'num_of_ipv6_routes')
168
+ self.num_of_ipv6_routes = attributes[:'num_of_ipv6_routes']
169
+ end
170
+
171
+ if attributes.key?(:'rir')
172
+ self.rir = attributes[:'rir']
173
+ end
174
+
175
+ if attributes.key?(:'routes')
176
+ if (value = attributes[:'routes']).is_a?(Array)
177
+ self.routes = value
178
+ end
179
+ end
180
+
181
+ if attributes.key?(:'upstreams')
182
+ if (value = attributes[:'upstreams']).is_a?(Array)
183
+ self.upstreams = value
184
+ end
185
+ end
186
+
187
+ if attributes.key?(:'downstreams')
188
+ if (value = attributes[:'downstreams']).is_a?(Array)
189
+ self.downstreams = value
190
+ end
191
+ end
192
+
193
+ if attributes.key?(:'peers')
194
+ if (value = attributes[:'peers']).is_a?(Array)
195
+ self.peers = value
196
+ end
197
+ end
198
+
199
+ if attributes.key?(:'whois_response')
200
+ self.whois_response = attributes[:'whois_response']
201
+ end
202
+ end
203
+
204
+ # Show invalid properties with the reasons. Usually used together with valid?
205
+ # @return Array for valid properties with the reasons
206
+ def list_invalid_properties
207
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
208
+ invalid_properties = Array.new
209
+ invalid_properties
210
+ end
211
+
212
+ # Check to see if the all the properties in the model are valid
213
+ # @return true if the model is valid
214
+ def valid?
215
+ warn '[DEPRECATED] the `valid?` method is obsolete'
216
+ true
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ as_number == o.as_number &&
225
+ organization == o.organization &&
226
+ country == o.country &&
227
+ asn_name == o.asn_name &&
228
+ type == o.type &&
229
+ domain == o.domain &&
230
+ date_allocated == o.date_allocated &&
231
+ allocation_status == o.allocation_status &&
232
+ num_of_ipv4_routes == o.num_of_ipv4_routes &&
233
+ num_of_ipv6_routes == o.num_of_ipv6_routes &&
234
+ rir == o.rir &&
235
+ routes == o.routes &&
236
+ upstreams == o.upstreams &&
237
+ downstreams == o.downstreams &&
238
+ peers == o.peers &&
239
+ whois_response == o.whois_response
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [as_number, organization, country, asn_name, type, domain, date_allocated, allocation_status, num_of_ipv4_routes, num_of_ipv6_routes, rir, routes, upstreams, downstreams, peers, whois_response].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ attributes = attributes.transform_keys(&:to_sym)
260
+ transformed_hash = {}
261
+ openapi_types.each_pair do |key, type|
262
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = nil
264
+ elsif type =~ /\AArray<(.*)>/i
265
+ # check to ensure the input is an array given that the attribute
266
+ # is documented as an array but the input is not
267
+ if attributes[attribute_map[key]].is_a?(Array)
268
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
269
+ end
270
+ elsif !attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
272
+ end
273
+ end
274
+ new(transformed_hash)
275
+ end
276
+
277
+ # Deserializes the data based on type
278
+ # @param string type Data type
279
+ # @param string value Value to be deserialized
280
+ # @return [Object] Deserialized data
281
+ def self._deserialize(type, value)
282
+ case type.to_sym
283
+ when :Time
284
+ Time.parse(value)
285
+ when :Date
286
+ Date.parse(value)
287
+ when :String
288
+ value.to_s
289
+ when :Integer
290
+ value.to_i
291
+ when :Float
292
+ value.to_f
293
+ when :Boolean
294
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
+ true
296
+ else
297
+ false
298
+ end
299
+ when :Object
300
+ # generic object (usually a Hash), return directly
301
+ value
302
+ when /\AArray<(?<inner_type>.+)>\z/
303
+ inner_type = Regexp.last_match[:inner_type]
304
+ value.map { |v| _deserialize(inner_type, v) }
305
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
+ k_type = Regexp.last_match[:k_type]
307
+ v_type = Regexp.last_match[:v_type]
308
+ {}.tap do |hash|
309
+ value.each do |k, v|
310
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
+ end
312
+ end
313
+ else # model
314
+ # models (e.g. Pet) or oneOf
315
+ klass = IpgeolocationSdk.const_get(type)
316
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
317
+ end
318
+ end
319
+
320
+ # Returns the string representation of the object
321
+ # @return [String] String presentation of the object
322
+ def to_s
323
+ to_hash.to_s
324
+ end
325
+
326
+ # to_body is an alias to to_hash (backward compatibility)
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_body
329
+ to_hash
330
+ end
331
+
332
+ # Returns the object in the form of hash
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_hash
335
+ hash = {}
336
+ self.class.attribute_map.each_pair do |attr, param|
337
+ value = self.send(attr)
338
+ if value.nil?
339
+ is_nullable = self.class.openapi_nullable.include?(attr)
340
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
341
+ end
342
+
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ # Outputs non-array value in the form of hash
349
+ # For object, use to_hash. Otherwise, just return the value
350
+ # @param [Object] value Any valid value
351
+ # @return [Hash] Returns the value in the form of hash
352
+ def _to_hash(value)
353
+ if value.is_a?(Array)
354
+ value.compact.map { |v| _to_hash(v) }
355
+ elsif value.is_a?(Hash)
356
+ {}.tap do |hash|
357
+ value.each { |k, v| hash[k] = _to_hash(v) }
358
+ end
359
+ elsif value.respond_to? :to_hash
360
+ value.to_hash
361
+ else
362
+ value
363
+ end
364
+ end
365
+
366
+ end
367
+
368
+ end