Class: Masklen::LookupResult

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

Overview

The primary result returned for a single IP lookup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#ipObject

Returns the value of attribute ip

Returns:

  • (Object)

    the current value of ip



101
102
103
# File 'lib/masklen/types.rb', line 101

def ip
  @ip
end

#localeObject

Returns the value of attribute locale

Returns:

  • (Object)

    the current value of locale



101
102
103
# File 'lib/masklen/types.rb', line 101

def locale
  @locale
end

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



101
102
103
# File 'lib/masklen/types.rb', line 101

def location
  @location
end

#networkObject

Returns the value of attribute network

Returns:

  • (Object)

    the current value of network



101
102
103
# File 'lib/masklen/types.rb', line 101

def network
  @network
end

#privacyObject

Returns the value of attribute privacy

Returns:

  • (Object)

    the current value of privacy



101
102
103
# File 'lib/masklen/types.rb', line 101

def privacy
  @privacy
end

Class Method Details

.from_hash(hash) ⇒ Object

Build a LookupResult from a parsed JSON hash.



110
111
112
113
114
115
116
117
118
# File 'lib/masklen/types.rb', line 110

def self.from_hash(hash)
  new(
    ip:       hash["ip"],
    location: Location.from_hash(hash["location"]),
    network:  Network.from_hash(hash["network"]),
    privacy:  Privacy.from_hash(hash["privacy"]),
    locale:   Locale.from_hash(hash["locale"])
  )
end