Class: Eol::Pages

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

Overview

Contains returns the scientific name for that page, and optionally contains information about common names, media (text, images and videos), and references to the hierarchies which recognize the taxon described on the page.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Pages

Returns a new instance of Pages.



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

def initialize(response)
  self.scientific_name = response['scientificName']
  self.richness_score = response['richness_score']
  self.taxon_concepts = response['taxonConcepts']
  self.data_objects = response['dataObjects']
end

Instance Attribute Details

#data_objectsArray

Returns an Array of Hashes.

Returns:

  • (Array)

    an Array of Hashes



21
22
23
# File 'lib/eol/pages.rb', line 21

def data_objects
  @data_objects
end

#richness_scoreInteger

EOL has developed a ‘Richness Score’ for taxon pages which provides a simple summary number for comparing the amount of information available for different pages.

Returns:

  • (Integer)

See Also:



17
18
19
# File 'lib/eol/pages.rb', line 17

def richness_score
  @richness_score
end

#scientific_nameString

Returns binomial nomenclature in zoology.

Returns:

  • (String)

    binomial nomenclature in zoology



11
12
13
# File 'lib/eol/pages.rb', line 11

def scientific_name
  @scientific_name
end

#taxon_conceptsArray

Returns an Array of Hashes.

Returns:

  • (Array)

    an Array of Hashes



19
20
21
# File 'lib/eol/pages.rb', line 19

def taxon_concepts
  @taxon_concepts
end

Instance Method Details

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

Yields:



30
31
32
33
34
35
# File 'lib/eol/pages.rb', line 30

def each
  yield @scientific_name
  yield @richness_score
  yield @taxon_concepts
  yield @data_objects
end