Class: GuardianSearcher::SectionResult
- Inherits:
-
Object
- Object
- GuardianSearcher::SectionResult
- Defined in:
- lib/guardian_searcher/section_result.rb
Instance Attribute Summary collapse
-
#editions ⇒ Object
readonly
Returns the value of attribute editions.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(results: nil, editions: nil) ⇒ SectionResult
constructor
A new instance of SectionResult.
Constructor Details
#initialize(results: nil, editions: nil) ⇒ SectionResult
Returns a new instance of SectionResult.
9 10 11 12 13 14 15 16 |
# File 'lib/guardian_searcher/section_result.rb', line 9 def initialize( results: nil, editions: nil ) @results = results @editions = editions end |
Instance Attribute Details
#editions ⇒ Object (readonly)
Returns the value of attribute editions.
7 8 9 |
# File 'lib/guardian_searcher/section_result.rb', line 7 def editions @editions end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
7 8 9 |
# File 'lib/guardian_searcher/section_result.rb', line 7 def results @results end |
Class Method Details
.parse_results(body: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/guardian_searcher/section_result.rb', line 18 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 |