Class: WhoisFreaks::IpSecurity
- Inherits:
-
Object
- Object
- WhoisFreaks::IpSecurity
- Defined in:
- lib/whoisfreaks/models/ip_security.rb
Instance Attribute Summary collapse
-
#cloud_provider_name ⇒ Object
Returns the value of attribute cloud_provider_name.
-
#is_anonymous ⇒ Object
Returns the value of attribute is_anonymous.
-
#is_bot ⇒ Object
Returns the value of attribute is_bot.
-
#is_cloud_provider ⇒ Object
Returns the value of attribute is_cloud_provider.
-
#is_known_attacker ⇒ Object
Returns the value of attribute is_known_attacker.
-
#is_proxy ⇒ Object
Returns the value of attribute is_proxy.
-
#is_relay ⇒ Object
Returns the value of attribute is_relay.
-
#is_residential_proxy ⇒ Object
Returns the value of attribute is_residential_proxy.
-
#is_spam ⇒ Object
Returns the value of attribute is_spam.
-
#is_tor ⇒ Object
Returns the value of attribute is_tor.
-
#is_vpn ⇒ Object
Returns the value of attribute is_vpn.
-
#proxy_confidence_score ⇒ Object
Returns the value of attribute proxy_confidence_score.
-
#proxy_last_seen ⇒ Object
Returns the value of attribute proxy_last_seen.
-
#proxy_provider_names ⇒ Object
Returns the value of attribute proxy_provider_names.
-
#relay_provider_name ⇒ Object
Returns the value of attribute relay_provider_name.
-
#threat_score ⇒ Object
Returns the value of attribute threat_score.
-
#vpn_confidence_score ⇒ Object
Returns the value of attribute vpn_confidence_score.
-
#vpn_last_seen ⇒ Object
Returns the value of attribute vpn_last_seen.
-
#vpn_provider_names ⇒ Object
Returns the value of attribute vpn_provider_names.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ IpSecurity
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ IpSecurity
Initializes the object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 119 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `WhoisFreaks::IpSecurity` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `WhoisFreaks::IpSecurity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'threat_score') self.threat_score = attributes[:'threat_score'] end if attributes.key?(:'is_tor') self.is_tor = attributes[:'is_tor'] end if attributes.key?(:'is_proxy') self.is_proxy = attributes[:'is_proxy'] end if attributes.key?(:'proxy_provider_names') if (value = attributes[:'proxy_provider_names']).is_a?(Array) self.proxy_provider_names = value end end if attributes.key?(:'proxy_confidence_score') self.proxy_confidence_score = attributes[:'proxy_confidence_score'] end if attributes.key?(:'proxy_last_seen') self.proxy_last_seen = attributes[:'proxy_last_seen'] end if attributes.key?(:'is_residential_proxy') self.is_residential_proxy = attributes[:'is_residential_proxy'] end if attributes.key?(:'is_vpn') self.is_vpn = attributes[:'is_vpn'] end if attributes.key?(:'vpn_provider_names') if (value = attributes[:'vpn_provider_names']).is_a?(Array) self.vpn_provider_names = value end end if attributes.key?(:'vpn_confidence_score') self.vpn_confidence_score = attributes[:'vpn_confidence_score'] end if attributes.key?(:'vpn_last_seen') self.vpn_last_seen = attributes[:'vpn_last_seen'] end if attributes.key?(:'is_relay') self.is_relay = attributes[:'is_relay'] end if attributes.key?(:'relay_provider_name') self.relay_provider_name = attributes[:'relay_provider_name'] end if attributes.key?(:'is_anonymous') self.is_anonymous = attributes[:'is_anonymous'] end if attributes.key?(:'is_known_attacker') self.is_known_attacker = attributes[:'is_known_attacker'] end if attributes.key?(:'is_bot') self.is_bot = attributes[:'is_bot'] end if attributes.key?(:'is_spam') self.is_spam = attributes[:'is_spam'] end if attributes.key?(:'is_cloud_provider') self.is_cloud_provider = attributes[:'is_cloud_provider'] end if attributes.key?(:'cloud_provider_name') self.cloud_provider_name = attributes[:'cloud_provider_name'] end end |
Instance Attribute Details
#cloud_provider_name ⇒ Object
Returns the value of attribute cloud_provider_name.
54 55 56 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 54 def cloud_provider_name @cloud_provider_name end |
#is_anonymous ⇒ Object
Returns the value of attribute is_anonymous.
44 45 46 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 44 def is_anonymous @is_anonymous end |
#is_bot ⇒ Object
Returns the value of attribute is_bot.
48 49 50 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 48 def is_bot @is_bot end |
#is_cloud_provider ⇒ Object
Returns the value of attribute is_cloud_provider.
52 53 54 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 52 def is_cloud_provider @is_cloud_provider end |
#is_known_attacker ⇒ Object
Returns the value of attribute is_known_attacker.
46 47 48 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 46 def is_known_attacker @is_known_attacker end |
#is_proxy ⇒ Object
Returns the value of attribute is_proxy.
22 23 24 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 22 def is_proxy @is_proxy end |
#is_relay ⇒ Object
Returns the value of attribute is_relay.
40 41 42 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 40 def is_relay @is_relay end |
#is_residential_proxy ⇒ Object
Returns the value of attribute is_residential_proxy.
30 31 32 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 30 def is_residential_proxy @is_residential_proxy end |
#is_spam ⇒ Object
Returns the value of attribute is_spam.
50 51 52 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 50 def is_spam @is_spam end |
#is_tor ⇒ Object
Returns the value of attribute is_tor.
20 21 22 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 20 def is_tor @is_tor end |
#is_vpn ⇒ Object
Returns the value of attribute is_vpn.
32 33 34 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 32 def is_vpn @is_vpn end |
#proxy_confidence_score ⇒ Object
Returns the value of attribute proxy_confidence_score.
26 27 28 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 26 def proxy_confidence_score @proxy_confidence_score end |
#proxy_last_seen ⇒ Object
Returns the value of attribute proxy_last_seen.
28 29 30 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 28 def proxy_last_seen @proxy_last_seen end |
#proxy_provider_names ⇒ Object
Returns the value of attribute proxy_provider_names.
24 25 26 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 24 def proxy_provider_names @proxy_provider_names end |
#relay_provider_name ⇒ Object
Returns the value of attribute relay_provider_name.
42 43 44 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 42 def relay_provider_name @relay_provider_name end |
#threat_score ⇒ Object
Returns the value of attribute threat_score.
18 19 20 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 18 def threat_score @threat_score end |
#vpn_confidence_score ⇒ Object
Returns the value of attribute vpn_confidence_score.
36 37 38 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 36 def vpn_confidence_score @vpn_confidence_score end |
#vpn_last_seen ⇒ Object
Returns the value of attribute vpn_last_seen.
38 39 40 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 38 def vpn_last_seen @vpn_last_seen end |
#vpn_provider_names ⇒ Object
Returns the value of attribute vpn_provider_names.
34 35 36 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 34 def vpn_provider_names @vpn_provider_names end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 293 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = WhoisFreaks.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
82 83 84 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 82 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 57 def self.attribute_map { :'threat_score' => :'threat_score', :'is_tor' => :'is_tor', :'is_proxy' => :'is_proxy', :'proxy_provider_names' => :'proxy_provider_names', :'proxy_confidence_score' => :'proxy_confidence_score', :'proxy_last_seen' => :'proxy_last_seen', :'is_residential_proxy' => :'is_residential_proxy', :'is_vpn' => :'is_vpn', :'vpn_provider_names' => :'vpn_provider_names', :'vpn_confidence_score' => :'vpn_confidence_score', :'vpn_last_seen' => :'vpn_last_seen', :'is_relay' => :'is_relay', :'relay_provider_name' => :'relay_provider_name', :'is_anonymous' => :'is_anonymous', :'is_known_attacker' => :'is_known_attacker', :'is_bot' => :'is_bot', :'is_spam' => :'is_spam', :'is_cloud_provider' => :'is_cloud_provider', :'cloud_provider_name' => :'cloud_provider_name' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 269 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
112 113 114 115 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 112 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 87 def self.openapi_types { :'threat_score' => :'Integer', :'is_tor' => :'Boolean', :'is_proxy' => :'Boolean', :'proxy_provider_names' => :'Array<String>', :'proxy_confidence_score' => :'Integer', :'proxy_last_seen' => :'String', :'is_residential_proxy' => :'Boolean', :'is_vpn' => :'Boolean', :'vpn_provider_names' => :'Array<String>', :'vpn_confidence_score' => :'Integer', :'vpn_last_seen' => :'String', :'is_relay' => :'Boolean', :'relay_provider_name' => :'String', :'is_anonymous' => :'Boolean', :'is_known_attacker' => :'Boolean', :'is_bot' => :'Boolean', :'is_spam' => :'Boolean', :'is_cloud_provider' => :'Boolean', :'cloud_provider_name' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 230 def ==(o) return true if self.equal?(o) self.class == o.class && threat_score == o.threat_score && is_tor == o.is_tor && is_proxy == o.is_proxy && proxy_provider_names == o.proxy_provider_names && proxy_confidence_score == o.proxy_confidence_score && proxy_last_seen == o.proxy_last_seen && is_residential_proxy == o.is_residential_proxy && is_vpn == o.is_vpn && vpn_provider_names == o.vpn_provider_names && vpn_confidence_score == o.vpn_confidence_score && vpn_last_seen == o.vpn_last_seen && is_relay == o.is_relay && relay_provider_name == o.relay_provider_name && is_anonymous == o.is_anonymous && is_known_attacker == o.is_known_attacker && is_bot == o.is_bot && is_spam == o.is_spam && is_cloud_provider == o.is_cloud_provider && cloud_provider_name == o.cloud_provider_name end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 364 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
256 257 258 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 256 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
262 263 264 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 262 def hash [threat_score, is_tor, is_proxy, proxy_provider_names, proxy_confidence_score, proxy_last_seen, is_residential_proxy, is_vpn, vpn_provider_names, vpn_confidence_score, vpn_last_seen, is_relay, relay_provider_name, is_anonymous, is_known_attacker, is_bot, is_spam, is_cloud_provider, cloud_provider_name].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
215 216 217 218 219 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 215 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
340 341 342 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 340 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 346 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
334 335 336 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 334 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
223 224 225 226 |
# File 'lib/whoisfreaks/models/ip_security.rb', line 223 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |