Class: Mihari::Structs::Shodan::Location
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::Shodan::Location
- Defined in:
- lib/mihari/structs/shodan.rb
Instance Attribute Summary collapse
- #country_code ⇒ String? readonly
- #country_name ⇒ String? readonly
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#country_code ⇒ String? (readonly)
9 |
# File 'lib/mihari/structs/shodan.rb', line 9 attribute :country_code, Types::String.optional |
#country_name ⇒ String? (readonly)
13 |
# File 'lib/mihari/structs/shodan.rb', line 13 attribute :country_name, Types::String.optional |
Class Method Details
.from_dynamic!(d) ⇒ Location
33 34 35 36 37 38 39 |
# File 'lib/mihari/structs/shodan.rb', line 33 def from_dynamic!(d) d = Types::Hash[d] new( country_code: d["country_code"], country_name: d["country_name"] ) end |
Instance Method Details
#geolocation ⇒ Mihari::Geolocation?
18 19 20 21 22 23 24 25 |
# File 'lib/mihari/structs/shodan.rb', line 18 def geolocation return nil if country_name.nil? || country_code.nil? Mihari::Models::Geolocation.new( country: country_name, country_code: ) end |