Class: IngvQuake::FullInfoEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/ingv_quake/models/full_info_event.rb

Overview

The FullInfoEvent class describes a seismic event which does not necessarily need to be a tectonic earthquake. An event is usually associated with one or more origins, which contain information about focal time and geographical location of the event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, shake_map: nil) ⇒ FullInfoEvent

Initializes a new FullInfoEvent instance with the provided data.

Parameters:

  • data (Hash)

    A hash containing detailed information about an event.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ingv_quake/models/full_info_event.rb', line 37

def initialize(data:, shake_map: nil)
  @creation_info = data.fetch('creationInfo', nil)&.then { |creation_info_data| CreationInfo.new(creation_info_data) }
  @focal_mechanism = data.fetch('focalMechanism', nil)&.then { |focal_mechanism_data| FocalMechanism.new(focal_mechanism_data) }
  @location = data.dig('description', 'text')
  @location_description_type = data.dig('description', 'type')
  @magnitude = data.fetch('magnitude', nil)&.then { |magnitude_data| Magnitude.new(magnitude_data) }
  @origin = data.fetch('origin', nil)&.then { |origin_data| Origin.new(origin_data) }
  @preferred_focal_mechanism_id = data.fetch('preferredFocalMechanismID', nil)
  @preferred_magnitude_id = data.fetch('preferredMagnitudeID', nil)
  @preferred_origin_id = data.fetch('preferredOriginID', nil)
  @public_id = data.fetch('publicID', nil)
  @type = data.fetch('type', nil)
  @shake_map = shake_map&.then { |shake_map_data| ShakeMap.new(shake_map_data) }
end

Instance Attribute Details

#creation_infoCreationInfo (readonly)

The creation info of the event.

Returns:



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def creation_info
  @creation_info
end

#focal_mechanismFocalMechanism (readonly)

The focal mechanism of the event.

Returns:



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def focal_mechanism
  @focal_mechanism
end

#locationString (readonly)

The location of the event.

Returns:

  • (String)

    the current value of location



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def location
  @location
end

#location_description_typeString (readonly)

The location of the event. Can be one of: ‘felt report’, ‘Flinn-Engdahl region’, ‘local time’, ‘tectonic summary’, ‘nearest cities’, ‘earthquake name’, ‘region name’.

Returns:

  • (String)

    the current value of location_description_type



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def location_description_type
  @location_description_type
end

#magnitudeMagnitude (readonly)

Reference to an associated Magnitude.

Returns:

  • (Magnitude)

    the current value of magnitude



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def magnitude
  @magnitude
end

#originOrigin (readonly)

Reference to an associated Origin.

Returns:

  • (Origin)

    the current value of origin



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def origin
  @origin
end

#preferred_focal_mechanism_idString (readonly)

Refers to the publicID of the preferred Focal Mechanism object.

Returns:

  • (String)

    the current value of preferred_focal_mechanism_id



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def preferred_focal_mechanism_id
  @preferred_focal_mechanism_id
end

#preferred_magnitude_idString (readonly)

Refers to the publicID of the preferred Magnitude object.

Returns:

  • (String)

    the current value of preferred_magnitude_id



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def preferred_magnitude_id
  @preferred_magnitude_id
end

#preferred_origin_idString (readonly)

Refers to the publicID of the preferred Origin object.

Returns:

  • (String)

    the current value of preferred_origin_id



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def preferred_origin_id
  @preferred_origin_id
end

#public_idString (readonly)

Resource identifier of Event.

Returns:

  • (String)

    the current value of public_id



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def public_id
  @public_id
end

#shake_mapShakeMap (readonly)

ShakeMap attributes are images that provides near-time maps of ground shaking for Magnitude >= 3.0 earthquakes in Italy and neighbouring areas. <b>This is a custom attribute.<b>

Returns:

  • (ShakeMap)

    the current value of shake_map



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def shake_map
  @shake_map
end

#typeString (readonly)

The type of the event. Can be one of: ‘not existing’, ‘not reported’, ‘earthquake’, ‘anthropogenic event’, ‘collapse’, ‘cavity collapse’, ‘mine collapse’, ‘building collapse’, ‘explosion’, ‘accidental explosion’, ‘chemical explosion’, ‘controlled explosion’, ‘experimental explosion’, ‘industrial explosion’, ‘mining explosion’, ‘quarry blast’, ‘road cut’, ‘blasting levee’, ‘nuclear explosion’, ‘induced or triggered event’, ‘rock burst’, ‘reservoir loading’, ‘fluid injection’, ‘fluid extraction’, ‘crash’, ‘plane crash’, ‘train crash’, ‘boat crash’, ‘other event’, ‘atmospheric event’, ‘sonic boom’, ‘sonic blast’, ‘acoustic noise’, ‘thunder’, ‘avalanche’, ‘snow avalanche’, ‘debris avalanche’, ‘hydroacoustic event’, ‘ice quake’, ‘slide’, ‘landslide’, ‘rockslide’, ‘meteorite’, ‘volcanic eruption’.

Returns:

  • (String)

    the current value of type



29
30
31
# File 'lib/ingv_quake/models/full_info_event.rb', line 29

def type
  @type
end