Class: Mihari::Structs::Censys::Location

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/mihari/structs/censys.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countryString? (readonly)

Returns:

  • (String, nil)


36
# File 'lib/mihari/structs/censys.rb', line 36

attribute :country, Types::String.optional

#country_codeString? (readonly)

Returns:

  • (String, nil)


40
# File 'lib/mihari/structs/censys.rb', line 40

attribute :country_code, Types::String.optional

Class Method Details

.from_dynamic!(d) ⇒ Object

Parameters:

  • d (Hash)


60
61
62
63
64
65
66
# File 'lib/mihari/structs/censys.rb', line 60

def from_dynamic!(d)
  d = Types::Hash[d]
  new(
    country: d["country"],
    country_code: d["country_code"]
  )
end

Instance Method Details

#geolocationMihari::Geolocation

Returns <description>.

Returns:

  • (Mihari::Geolocation)

    <description>



45
46
47
48
49
50
51
52
53
54
# File 'lib/mihari/structs/censys.rb', line 45

def geolocation
  # sometimes Censys overlooks country
  # then set geolocation as nil
  return nil if country.nil?

  Mihari::Models::Geolocation.new(
    country: country,
    country_code: country_code
  )
end