Class: Sandy::Provider::LIPA::Report
- Inherits:
-
Object
- Object
- Sandy::Provider::LIPA::Report
- Includes:
- StormCenter
- Defined in:
- lib/sandy/providers/lipa/report.rb
Instance Attribute Summary collapse
-
#areas ⇒ Object
readonly
Returns the value of attribute areas.
Instance Method Summary collapse
-
#initialize ⇒ Report
constructor
A new instance of Report.
Methods included from StormCenter
#recursive_fetch_areas, #sanitize_name
Methods included from CoordinateCache
#cached_coordinates_for, #gps_data
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sandy/providers/lipa/report.rb', line 8 def initialize raw_report = HTTParty.get(lipa_url, format: :xml) area_hash = raw_report.fetch("root").fetch("curr_custs_aff")["areas"]["area"]["areas"].first[1] @areas = recursive_fetch_areas( area_hash, ->(area) { area.fetch("areas", {}).fetch("area", nil) } ) rescue raise LoadError, "LIPA response was not recognizable." end |
Instance Attribute Details
#areas ⇒ Object (readonly)
Returns the value of attribute areas.
6 7 8 |
# File 'lib/sandy/providers/lipa/report.rb', line 6 def areas @areas end |