Class: Gull::Client
- Inherits:
-
Object
- Object
- Gull::Client
- Defined in:
- lib/gull/client.rb
Overview
Client exposes methods and options for fetching alerts from the NWS/NOAA web service
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/gull/client.rb', line 10 def initialize( = {}) = { url: 'http://alerts.weather.gov/cap/us.php?x=1', strict: false }.merge end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
8 9 10 |
# File 'lib/gull/client.rb', line 8 def errors @errors end |
Instance Method Details
#fetch ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gull/client.rb', line 17 def fetch self.errors = [] content = response document = Nokogiri::XML content do |config| config.strict if [:strict] end process document.xpath('//xmlns:feed/xmlns:entry', namespaces) end |