Class: Eol::Search

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/eol/search.rb

Overview

Contains search results from the Encyclopedia of Life database.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Search

Returns a new instance of Search.



16
17
18
19
20
21
# File 'lib/eol/search.rb', line 16

def initialize(response)
  self.id = response['id']
  self.title = response['title']
  self.link = response['link']
  self.content = response['content']
end

Instance Attribute Details

#contentString

Returns classification content.

Returns:

  • (String)

    classification content



14
15
16
# File 'lib/eol/search.rb', line 14

def content
  @content
end

#idInteger

Returns the id of the species.

Returns:

  • (Integer)

    the id of the species



8
9
10
# File 'lib/eol/search.rb', line 8

def id
  @id
end

Returns link to article on the EOL homepage.

Returns:

  • (String)

    link to article on the EOL homepage



12
13
14
# File 'lib/eol/search.rb', line 12

def link
  @link
end

#titleString

Returns title of the entry.

Returns:

  • (String)

    title of the entry



10
11
12
# File 'lib/eol/search.rb', line 10

def title
  @title
end

Instance Method Details

#each {|@id| ... } ⇒ Object

Yields:



23
24
25
26
27
28
# File 'lib/eol/search.rb', line 23

def each
  yield @id
  yield @title
  yield @link
  yield @content
end