Class: GuardianSearcher::SectionResult
- Inherits:
-
Object
- Object
- GuardianSearcher::SectionResult
- Defined in:
- lib/guardian_searcher/section_result.rb
Overview
The class parses the search results and creates a new SearchResults object with an editions variable
Class Method Summary collapse
Class Method Details
.parse_results(body: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/guardian_searcher/section_result.rb', line 9 def self.parse_results(body: nil) return unless body body = JSON.parse(body) response = body["response"] GuardianSearcher::SearchResult.new( results: response["results"], editions: response["results"][0]["editions"] ) end |