Class: Nws::Api::Alerts::Client
- Inherits:
-
Object
- Object
- Nws::Api::Alerts::Client
- Includes:
- HTTParty
- Defined in:
- lib/nws/api/alerts/client.rb
Instance Method Summary collapse
- #fetch_raw_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil, path: nil) ⇒ Object
- #get_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil) ⇒ Object
Instance Method Details
#fetch_raw_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil, path: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/nws/api/alerts/client.rb', line 22 def fetch_raw_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil, path: nil) path ||= "/alerts?message_type=#{}&status=#{status}" path << "&urgency=#{urgency}" if urgency path << "&severity=#{severity}" if severity path << "&certainty=#{certainty}" if certainty patch << "&limit=#{limit}" if limit raw_result = self.class.get(path) JSON.parse(raw_result) end |
#get_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nws/api/alerts/client.rb', line 10 def get_alerts(message_type: 'alert', status: 'actual', urgency: nil, severity: nil, certainty: nil, limit: nil) parsed = fetch_raw_alerts(message_type: , status: status, urgency: urgency, severity: severity, certainty: certainty, limit: limit) alerts = Alert.from_api_response(self, parsed) return alerts end |