Class: OpenMeteo::Entities::Search
- Inherits:
-
Object
- Object
- OpenMeteo::Entities::Search
- Defined in:
- lib/open_meteo/entities/search.rb
Overview
A list of possible locations from the Geocoding API
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#raw_json ⇒ Object
readonly
Returns the value of attribute raw_json.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(json_body) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(json_body) ⇒ Search
Returns a new instance of Search.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/open_meteo/entities/search.rb', line 35 def initialize(json_body) @raw_json = json_body @results = json_body["results"].map do |result| normalized_result = result.transform_keys { |key| key.to_s.gsub(/(\w)(\d)/, '\1_\2') } SearchResult.new(normalized_result) end @attributes = json_body.keys end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
33 34 35 |
# File 'lib/open_meteo/entities/search.rb', line 33 def attributes @attributes end |
#raw_json ⇒ Object (readonly)
Returns the value of attribute raw_json.
33 34 35 |
# File 'lib/open_meteo/entities/search.rb', line 33 def raw_json @raw_json end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
33 34 35 |
# File 'lib/open_meteo/entities/search.rb', line 33 def results @results end |