Class: IngvQuake::FullInfoEventParser
- Inherits:
-
ApplicationService
- Object
- ApplicationService
- IngvQuake::FullInfoEventParser
- Defined in:
- lib/ingv_quake/services/full_info_event_parser.rb
Overview
The FullInfoEventParser class is responsible for parsing response data containing full information about earthquake events. It inherits from the ApplicationService base class.
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#call ⇒ Array<FullInfoEvent>
Parses the response data and creates an array of FullInfoEvent objects.
-
#initialize(response) ⇒ FullInfoEventParser
constructor
Initializes a new FullInfoEventParser instance with the response data.
Methods inherited from ApplicationService
Constructor Details
#initialize(response) ⇒ FullInfoEventParser
Initializes a new FullInfoEventParser instance with the response data.
13 14 15 |
# File 'lib/ingv_quake/services/full_info_event_parser.rb', line 13 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/ingv_quake/services/full_info_event_parser.rb', line 8 def response @response end |
Instance Method Details
#call ⇒ Array<FullInfoEvent>
Parses the response data and creates an array of FullInfoEvent objects.
20 21 22 23 24 25 |
# File 'lib/ingv_quake/services/full_info_event_parser.rb', line 20 def call events = response.dig('quakeml', 'eventParameters', 'event') || [] events = [events] if events.is_a? Hash events.map { |data| create_full_info_event(data) } end |