Class: IngvQuake::EventResource
- Defined in:
- lib/ingv_quake/resources/events.rb
Overview
The EventResource class is a subclass of the Resource class, providing additional methods for querying earthquake events with specific filters.
Constant Summary
Constants inherited from Resource
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#between_dates(starttime:, endtime:, **params) ⇒ Array
Queries events that occurred between the specified start and end times.
-
#between_magnitude(minmag:, maxmag:, **params) ⇒ Array
Queries events with magnitudes between the specified minimum and maximum values.
-
#starting_from(starttime:, **params) ⇒ Array
Queries events that occurred after the specified start time.
-
#where(params = {}) ⇒ Array
An array of parsed event objects.
-
#within_last_day(**params) ⇒ Array
Queries events that occurred within the last day.
-
#within_last_hour(**params) ⇒ Array
Queries events that occurred within the last hour.
-
#within_last_month(**params) ⇒ Array
Queries events that occurred within the last month.
-
#within_last_week(**params) ⇒ Array
Queries events that occurred within the last week.
Methods inherited from Resource
#get_events_request, #initialize
Constructor Details
This class inherits a constructor from IngvQuake::Resource
Instance Method Details
#between_dates(starttime:, endtime:, **params) ⇒ Array
Queries events that occurred between the specified start and end times.
57 58 59 |
# File 'lib/ingv_quake/resources/events.rb', line 57 def between_dates(starttime:, endtime:, **params) send_request({ starttime: format_datetime(starttime), endtime: format_datetime(endtime), **params }) end |
#between_magnitude(minmag:, maxmag:, **params) ⇒ Array
Queries events with magnitudes between the specified minimum and maximum values.
76 77 78 |
# File 'lib/ingv_quake/resources/events.rb', line 76 def between_magnitude(minmag:, maxmag:, **params) send_request({ minmag: minmag, maxmag: maxmag, **params }) end |
#starting_from(starttime:, **params) ⇒ Array
Queries events that occurred after the specified start time.
66 67 68 |
# File 'lib/ingv_quake/resources/events.rb', line 66 def starting_from(starttime:, **params) send_request({ starttime: format_datetime(starttime), **params }) end |
#where(params = {}) ⇒ Array
Returns An array of parsed event objects.
47 48 49 |
# File 'lib/ingv_quake/resources/events.rb', line 47 def where(params = {}) send_request(params) end |
#within_last_day(**params) ⇒ Array
Queries events that occurred within the last day.
93 94 95 96 |
# File 'lib/ingv_quake/resources/events.rb', line 93 def within_last_day(**params) a_day_ago = DateTime.now.prev_day send_request({ starttime: format_datetime(a_day_ago), **params }) end |
#within_last_hour(**params) ⇒ Array
Queries events that occurred within the last hour.
84 85 86 87 |
# File 'lib/ingv_quake/resources/events.rb', line 84 def within_last_hour(**params) an_hour_ago = DateTime.now - Rational(1, 24) send_request({ starttime: format_datetime(an_hour_ago), **params }) end |
#within_last_month(**params) ⇒ Array
Queries events that occurred within the last month.
111 112 113 114 |
# File 'lib/ingv_quake/resources/events.rb', line 111 def within_last_month(**params) a_month_ago = DateTime.now.prev_month send_request({ starttime: format_datetime(a_month_ago), **params }) end |
#within_last_week(**params) ⇒ Array
Queries events that occurred within the last week.
102 103 104 105 |
# File 'lib/ingv_quake/resources/events.rb', line 102 def within_last_week(**params) a_week_ago = (DateTime.now - 7) send_request({ starttime: format_datetime(a_week_ago), **params }) end |