Class: CommonChemistry::SearchResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/commonchemistry.rb

Overview

Represents a search response from the API

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject (readonly)

Returns the value of attribute count.



99
100
101
# File 'lib/commonchemistry.rb', line 99

def count
  @count
end

#resultsObject (readonly)

Returns the value of attribute results.



99
100
101
# File 'lib/commonchemistry.rb', line 99

def results
  @results
end