Module: Gbif::Registry
- Defined in:
- lib/gbifrb/Registry.rb,
lib/gbifrb/get_data.rb
Class Method Summary collapse
-
.dataset_metrics(uuid:, verbose: nil, options: nil) ⇒ Object
Get details on a GBIF dataset.
-
.dataset_search(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, decade: nil, publishingCountry: nil, facet: nil, facetMincount: nil, facetMultiselect: nil, hl: false, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Full text search across all datasets.
-
.dataset_suggest(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, publishingCountry: nil, decade: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Search that returns up to 20 matching datasets.
-
.datasets(data: 'all', type: nil, uuid: nil, query: nil, id: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Object
Search for datasets and dataset metadata.
-
.datasets_fetch(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:.
-
.getdata_dataset_metrics(x, verbose, options) ⇒ Object
:nodoc:.
-
.getdata_installations(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:.
-
.getdata_networks(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:.
-
.getdata_nodes(x, uuid, opts, isocode, verbose, options) ⇒ Object
:nodoc:.
-
.getdata_orgs(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:.
-
.installations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Installations metadata.
-
.networks(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Networks metadata.
-
.nodes(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, isocode: nil, verbose: nil, options: nil) ⇒ Hash
Nodes metadata.
-
.organizations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Organizations metadata.
Class Method Details
.dataset_metrics(uuid:, verbose: nil, options: nil) ⇒ Object
Get details on a GBIF dataset.
References: www.gbif.org/developer/registry#datasetMetrics
257 258 259 260 261 262 263 264 |
# File 'lib/gbifrb/Registry.rb', line 257 def self.dataset_metrics(uuid:, verbose: nil, options: nil) if len2(uuid) == 1 return self.getdata_dataset_metrics(uuid, verbose, ) else raise "not ready yet" # return [self.getdata_dataset_metrics(x, verbose, options) for x in uuid] end end |
.dataset_search(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, decade: nil, publishingCountry: nil, facet: nil, facetMincount: nil, facetMultiselect: nil, hl: false, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Note that you can pass in additional faceting parameters on a per field basis. For example, if you want to limit the numbef of facets returned from a field ‘foo’ to 3 results, pass in ‘foo_facetLimit = 3’. GBIF does not allow all per field parameters, but does allow some. See also examples.
Full text search across all datasets. Results are ordered by relevance.
References: www.gbif.org/developer/registry#datasetSearch
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/gbifrb/Registry.rb', line 466 def self.dataset_search(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, decade: nil, publishingCountry: nil, facet: nil, facetMincount: nil, facetMultiselect: nil, hl: false, limit: 100, offset: nil, verbose: nil, options: nil) arguments = {q: q, type: type, keyword: keyword, owningOrg: owningOrg, publishingOrg: publishingOrg, hostingOrg: hostingOrg, decade: decade, publishingCountry: publishingCountry, facet: facet, facetMincount: facetMincount, facetMultiselect: facetMultiselect, hl: hl, limit: limit, offset: offset}.tostrings opts = arguments.delete_if { |k, v| v.nil? } Request.new('dataset/search', opts, verbose, ).perform end |
.dataset_suggest(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, publishingCountry: nil, decade: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Search that returns up to 20 matching datasets. Results are ordered by relevance.
References: www.gbif.org/developer/registry#datasetSearch
357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/gbifrb/Registry.rb', line 357 def self.dataset_suggest(q: nil, type: nil, keyword: nil, owningOrg: nil, publishingOrg: nil, hostingOrg: nil, publishingCountry: nil, decade: nil, limit: 100, offset: nil, verbose: nil, options: nil) arguments = { q: q, type: type, keyword: keyword, publishingOrg: publishingOrg, hostingOrg: hostingOrg, owningOrg: owningOrg, decade: decade, publishingCountry: publishingCountry, limit: limit, offset: offset}.tostrings opts = arguments.delete_if { |k, v| v.nil? } Request.new('dataset/suggest', opts, verbose, ).perform end |
.datasets(data: 'all', type: nil, uuid: nil, query: nil, id: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Object
Search for datasets and dataset metadata.
References www.gbif.org/developer/registry#datasets
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/gbifrb/Registry.rb', line 293 def self.datasets(data: 'all', type: nil, uuid: nil, query: nil, id: nil, limit: 100, offset: nil, verbose: nil, options: nil) arguments = { q: query, type: type, limit: limit, offset: offset}.tostrings opts = arguments.delete_if { |k, v| v.nil? } data_choices = ['all', 'organization', 'contact', 'endpoint', 'identifier', 'tag', 'machinetag', 'comment', 'constituents', 'document', 'metadata', 'deleted', 'duplicate', 'subDataset', 'withNoEndpoint'] check_data(data, data_choices) if len2(data) == 1 return self.datasets_fetch(data, uuid, opts, verbose, ) else raise "not ready yet" # return [self.datasets_fetch(x, uuid, args, **kwargs) for x in data] end end |
.datasets_fetch(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/gbifrb/get_data.rb', line 103 def self.datasets_fetch(x, uuid, opts, verbose, ) # :nodoc: if !['all','deleted','duplicate','subDataset','withNoEndpoint'].include? x and uuid.nil? stop('You must specify a uuid if data does not equal all and data does not equal of deleted, duplicate, subDataset, or withNoEndpoint') end if uuid.nil? if x == 'all' url = 'dataset' else if !id.nil? and x == 'metadata' url = 'dataset/metadata/' + id + '/document' else url = 'dataset/' + x end end else if x == 'all' url = 'dataset/' + uuid else url = 'dataset/' + uuid + '/' + x end end Request.new(url, opts, verbose, ).perform end |
.getdata_dataset_metrics(x, verbose, options) ⇒ Object
:nodoc:
98 99 100 101 |
# File 'lib/gbifrb/get_data.rb', line 98 def self.getdata_dataset_metrics(x, verbose, ) # :nodoc: url = 'dataset/' + x + '/metrics' Request.new(url, {}, verbose, ).perform end |
.getdata_installations(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/gbifrb/get_data.rb', line 75 def self.getdata_installations(x, uuid, opts, verbose, ) # :nodoc: if !['all','deleted', 'nonPublishing'].include? x and uuid.nil? stop('You must specify a uuid if data does not equal all and data does not equal one of deleted or nonPublishing') end if uuid.nil? if x == 'all' url = 'installation' else url = 'installation/' + x end else if x == 'all' url = 'installation/' + uuid else url = 'installation/' + uuid + '/' + x end end Request.new(url, opts, verbose, ).perform # return {'meta': get_meta(res), 'data': parse_results(res, uuid)} end |
.getdata_networks(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gbifrb/get_data.rb', line 7 def self.getdata_networks(x, uuid, opts, verbose, ) #:nodoc: if x != 'all' and uuid.nil? stop('You must specify a uuid if data does not equal "all"') end if uuid.nil? url = 'network' else if x == 'all' url = 'network/' + uuid else url = 'network/' + uuid + '/' + x end end Request.new(url, opts, verbose, ).perform # return { meta: get_meta(res), data: parse_results(res, uuid) } end |
.getdata_nodes(x, uuid, opts, isocode, verbose, options) ⇒ Object
:nodoc:
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/gbifrb/get_data.rb', line 24 def self.getdata_nodes(x, uuid, opts, isocode, verbose, ) #:nodoc: if x != 'all' and uuid.nil? stop('You must specify a uuid if data does not equal "all"') end if uuid.nil? if x == 'all' url = 'node' else if !isocode.nil? and x == 'country' url = 'node/country/' + isocode else url = 'node/' + x end end else if x == 'all' url = 'node/' + uuid else url = 'node/' + uuid + '/' + x end end Request.new(url, opts, verbose, ).perform # return {'meta': get_meta(res), 'data': parse_results(res, uuid)} end |
.getdata_orgs(x, uuid, opts, verbose, options) ⇒ Object
:nodoc:
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/gbifrb/get_data.rb', line 51 def self.getdata_orgs(x, uuid, opts, verbose, ) # :nodoc: nouuid = ['all', 'deleted', 'pending', 'nonPublishing'] if !nouuid.include? x and uuid.nil? stop('You must specify a uuid if data does not equal "all" and data does not equal one of ' + nouuid.join(', ')) end if uuid.nil? if x == 'all' url = 'organization' else url = 'organization/' + x end else if x == 'all' url = 'organization/' + uuid else url = 'organization/' + uuid + '/' + x end end Request.new(url, opts, verbose, ).perform # return {'meta': get_meta(res), 'data': parse_results(res, uuid)} end |
.installations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Installations metadata.
References: www.gbif.org/developer/registry#installations
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/gbifrb/Registry.rb', line 223 def self.installations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) arguments = { q: q, limit: limit, offset: offset, identifier: identifier, identifierType: identifierType }.tostrings opts = arguments.delete_if { |k, v| v.nil? } data_choices = ['all', 'contact', 'endpoint', 'dataset', 'identifier', 'tag', 'machineTag', 'comment', 'deleted', 'nonPublishing'] check_data(data, data_choices) self.getdata_installations(data, uuid, opts, verbose, ) # if len2(data) == 1 # return self.getdata_installations(data, uuid, opts, verbose, options) # else # return [self.getdata_installations(x, uuid, opts, verbose, options) for x in data] # end end |
.networks(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Networks metadata
References: www.gbif.org/developer/registry#networks
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/gbifrb/Registry.rb', line 47 def self.networks(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) arguments = { q: q, limit: limit, offset: offset, identifier: identifier, identifierType: identifierType}.tostrings opts = arguments.delete_if { |k, v| v.nil? } data_choices = ['all', 'contact', 'endpoint', 'identifier', 'tag', 'machineTag', 'comment', 'constituents'] check_data(data, data_choices) return self.getdata_networks(data, uuid, opts, verbose, ) # if len2(data) == 1 # return getdata(data, uuid, args) # else # return [getdata(x, uuid, args) for x in data] # end end |
.nodes(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, isocode: nil, verbose: nil, options: nil) ⇒ Hash
Nodes metadata
References www.gbif.org/developer/registry#nodes
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/gbifrb/Registry.rb', line 110 def self.nodes(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, isocode: nil, verbose: nil, options: nil) arguments = { q: q, limit: limit, offset: offset, identifier: identifier, identifierType: identifierType }.tostrings opts = arguments.delete_if { |k, v| v.nil? } data_choices = ['all', 'organization', 'endpoint', 'identifier', 'tag', 'machineTag', 'comment', 'pendingEndorsement', 'country', 'dataset', 'installation'] check_data(data, data_choices) return self.getdata_nodes(data, uuid, opts, isocode, verbose, ) # if len2(data) == 1 # return self.getdata_nodes(data, uuid, args) # else # return [self.getdata_nodes(x, uuid, args) for x in data] # end end |
.organizations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) ⇒ Hash
Organizations metadata
References: www.gbif.org/developer/registry#organizations
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/gbifrb/Registry.rb', line 167 def self.organizations(data: 'all', uuid: nil, q: nil, identifier: nil, identifierType: nil, limit: 100, offset: nil, verbose: nil, options: nil) arguments = { q: q, limit: limit, offset: offset, identifier: identifier, identifierType: identifierType }.tostrings opts = arguments.delete_if { |k, v| v.nil? } data_choices = ['all', 'contact', 'endpoint', 'identifier', 'tag', 'machineTag', 'comment', 'hostedDataset', 'ownedDataset', 'deleted', 'pending', 'nonPublishing'] check_data(data, data_choices) self.getdata_orgs(data, uuid, opts, verbose, ) # if len2(data) == 1 # return self.getdata_orgs(data, uuid, args, **kwargs) # else # return [self.getdata_orgs(x, uuid, args, **kwargs) for x in data] # end end |