Class: Masklen::Privacy

Inherits:
Struct
  • Object
show all
Defined in:
lib/masklen/types.rb

Overview

Privacy and threat indicators for an IP address.

threat_level is “low” or “medium”.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#hostingObject

Returns the value of attribute hosting

Returns:

  • (Object)

    the current value of hosting



55
56
57
# File 'lib/masklen/types.rb', line 55

def hosting
  @hosting
end

#proxyObject

Returns the value of attribute proxy

Returns:

  • (Object)

    the current value of proxy



55
56
57
# File 'lib/masklen/types.rb', line 55

def proxy
  @proxy
end

#threat_levelObject

Returns the value of attribute threat_level

Returns:

  • (Object)

    the current value of threat_level



55
56
57
# File 'lib/masklen/types.rb', line 55

def threat_level
  @threat_level
end

#torObject

Returns the value of attribute tor

Returns:

  • (Object)

    the current value of tor



55
56
57
# File 'lib/masklen/types.rb', line 55

def tor
  @tor
end

#vpnObject

Returns the value of attribute vpn

Returns:

  • (Object)

    the current value of vpn



55
56
57
# File 'lib/masklen/types.rb', line 55

def vpn
  @vpn
end

Class Method Details

.from_hash(hash) ⇒ Object

Build a Privacy from a parsed JSON hash. Returns nil if hash is nil.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/masklen/types.rb', line 64

def self.from_hash(hash)
  return nil if hash.nil?

  new(
    vpn:          hash["vpn"],
    proxy:        hash["proxy"],
    tor:          hash["tor"],
    hosting:      hash["hosting"],
    threat_level: hash["threat_level"]
  )
end