Class: CommonChemistry::SearchResponse
- Inherits:
-
Object
- Object
- CommonChemistry::SearchResponse
- Defined in:
- lib/commonchemistry.rb
Overview
Represents a search response from the API
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(data) ⇒ SearchResponse
constructor
A new instance of SearchResponse.
Constructor Details
#initialize(data) ⇒ SearchResponse
Returns a new instance of SearchResponse.
101 102 103 104 |
# File 'lib/commonchemistry.rb', line 101 def initialize(data) @count = data['count'].to_i @results = (data['results'] || []).map { |result| SearchResult.new(result) } end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
99 100 101 |
# File 'lib/commonchemistry.rb', line 99 def count @count end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
99 100 101 |
# File 'lib/commonchemistry.rb', line 99 def results @results end |