Class: DataScienceTheater3000::Coordinates2Politics
- Inherits:
-
Object
- Object
- DataScienceTheater3000::Coordinates2Politics
- Defined in:
- lib/data_science_theater_3000/coordinates2politics.rb
Instance Attribute Summary collapse
- #coordinates ⇒ Object private
Instance Method Summary collapse
-
#initialize(coordinates) ⇒ Coordinates2Politics
constructor
Accpets lat/lon coordinates and returns detailed political information.
- #result ⇒ Hash
Constructor Details
#initialize(coordinates) ⇒ Coordinates2Politics
Accpets lat/lon coordinates and returns detailed political information.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/data_science_theater_3000/coordinates2politics.rb', line 11 def initialize coordinates if coordinates.is_a?(Array) @coordinates = ActiveSupport::JSON.encode(coordinates.map!{|a|CGI::escape(a)}) if coordinates.is_a?(Array) elsif coordinates.is_a?(String) @coordinates = CGI::escape(coordinates) elsif coordinates.is_a?(Hash) coordinates = sanitize(coordinates) @coordinates = ActiveSupport::JSON.encode(coordinates.map!{|a| a.map!{|b| CGI::escape(b)}}) if coordinates.is_a?(Array) end end |
Instance Attribute Details
#coordinates ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/data_science_theater_3000/coordinates2politics.rb', line 5 def coordinates @coordinates end |
Instance Method Details
#result ⇒ Hash
24 25 26 |
# File 'lib/data_science_theater_3000/coordinates2politics.rb', line 24 def result dst_request.result end |