Module: Bananomia
- Extended by:
- Configuration
- Defined in:
- lib/bananomia.rb,
lib/bananomia/error.rb,
lib/bananomia/request.rb,
lib/bananomia/version.rb
Defined Under Namespace
Classes: BadGateway, BadRequest, Error, GatewayTimeout, InternalServerError, NotFound, Request, ServiceUnavailable
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.occurrence(id, verbose: false) ⇒ Hash, Boolean
Get and occurrence record.
-
.parse(names, verbose: false) ⇒ Array, Boolean
Parse human names.
-
.person(id, csv: nil, specimens: nil, page: nil, verbose: false) ⇒ Hash, ...
Get a person’s profile by ID or specimens.
-
.search_occurrences(dataset_id, occurrence_id, callback: nil, verbose: false) ⇒ Array, Boolean
Search occurrences.
-
.search_people(q, families_collected: nil, families_identified: nil, date: nil, page: nil, strict: nil, callback: nil, verbose: false) ⇒ Array, Boolean
Search human names.
-
.suggest(q, is_public: nil, has_occurrences: nil, limit: nil, verbose: false) ⇒ Array, Boolean
Suggest human names (autocomplete widget).
Methods included from Configuration
Class Method Details
.occurrence(id, verbose: false) ⇒ Hash, Boolean
Get and occurrence record
61 62 63 64 |
# File 'lib/bananomia.rb', line 61 def self.occurrence(id, verbose: false) endpoint = "occurrence/#{id}.jsonld" Request.new(endpoint: endpoint, verbose: verbose).perform end |
.parse(names, verbose: false) ⇒ Array, Boolean
Parse human names
22 23 24 25 26 27 28 29 |
# File 'lib/bananomia.rb', line 22 def self.parse(names, verbose: false) endpoint = "parse" Request.new( endpoint: endpoint, names: names, verbose: verbose ).perform end |
.person(id, csv: nil, specimens: nil, page: nil, verbose: false) ⇒ Hash, ...
Get a person’s profile by ID or specimens
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/bananomia.rb', line 40 def self.person(id, csv: nil, specimens: nil, page: nil, verbose: false) if csv and specimens extension = '.csv' else extension = '.jsonld' end if specimens endpoint = "#{id}/specimens#{extension}" else endpoint = "#{id}#{extension}" end Request.new(endpoint: endpoint, page: page, verbose: verbose).perform end |
.search_occurrences(dataset_id, occurrence_id, callback: nil, verbose: false) ⇒ Array, Boolean
Search occurrences
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bananomia.rb', line 106 def self.search_occurrences(dataset_id, occurrence_id, callback: nil, verbose: false) endpoint = 'occurrences/search' Request.new( endpoint: endpoint, dataset_id: dataset_id, occurrence_id: occurrence_id, callback: callback, verbose: verbose ).perform end |
.search_people(q, families_collected: nil, families_identified: nil, date: nil, page: nil, strict: nil, callback: nil, verbose: false) ⇒ Array, Boolean
Search human names
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bananomia.rb', line 81 def self.search_people(q, families_collected: nil, families_identified: nil, date: nil, page: nil, strict: nil, callback: nil, verbose: false) endpoint = 'users/search' Request.new( endpoint: endpoint, q: q, families_collected: families_collected, families_identified: families_identified, date: date, page: page, strict: strict, callback: callback, verbose: verbose ).perform end |
.suggest(q, is_public: nil, has_occurrences: nil, limit: nil, verbose: false) ⇒ Array, Boolean
Suggest human names (autocomplete widget)
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/bananomia.rb', line 126 def self.suggest(q, is_public: nil, has_occurrences: nil, limit: nil, verbose: false) endpoint = 'user.json' Request.new( endpoint: endpoint, q: q, is_public: is_public, has_occurrences: has_occurrences, limit: limit, verbose: verbose ).perform end |