colrapi 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +5 -2
- data/CHANGELOG.md +25 -0
- data/colrapi.gemspec +2 -3
- data/lib/colrapi/request.rb +19 -6
- data/lib/colrapi/version.rb +1 -1
- data/lib/colrapi.rb +38 -16
- metadata +9 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f9ef87ffca0e6ba50430ddbdff7fb385adfd38427338179ee4b4ae1ed774145
|
|
4
|
+
data.tar.gz: 3204710f6cac4d68b0699cc478a297205f5767f0368599f61ea27d99a99cdc42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6056004c3f1b6bb3d2e3751e1a06d8178e3b33ddb4615de5413d465565eb8a58bc115af123e95915a138ea51190fa89eeefb3dd6dc30a8aeb3a8129983318ea6
|
|
7
|
+
data.tar.gz: d15bdd735d0ef7315fe1e7cf5d000a9bd68520ce3608552f4473954ef872537569e376767f70d94febc667b97c886fab475593da562239e646d2ad769f9f22f5
|
data/.github/workflows/main.yml
CHANGED
|
@@ -5,12 +5,15 @@ on: [push,pull_request]
|
|
|
5
5
|
jobs:
|
|
6
6
|
build:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby-version: ['3.3.4', '4.0.0']
|
|
8
11
|
steps:
|
|
9
12
|
- uses: actions/checkout@v2
|
|
10
|
-
- name: Set up Ruby
|
|
13
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
11
14
|
uses: ruby/setup-ruby@v1
|
|
12
15
|
with:
|
|
13
|
-
ruby-version:
|
|
16
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
14
17
|
bundler-cache: true
|
|
15
18
|
- name: Run the default task
|
|
16
19
|
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.7] - 2026-06-17
|
|
4
|
+
- Allow Ruby 4.0.0:
|
|
5
|
+
- Relaxed `required_ruby_version` to `>= 2.5.0, < 5.0`
|
|
6
|
+
- Added Ruby 4.0.0 to the CI matrix
|
|
7
|
+
- Bumped `faraday-follow_redirects` upper bound to allow 0.5+ (which lifts the Ruby < 4 cap)
|
|
8
|
+
- Dropped the `bundler` development dependency
|
|
9
|
+
- Fixed duplicate `:status` argument in `Colrapi::Request`
|
|
10
|
+
- Updated tests to match current ChecklistBank API responses
|
|
11
|
+
|
|
12
|
+
## [0.1.6] - 2025-03-25
|
|
13
|
+
- Added more nameusage_search parameters:
|
|
14
|
+
- authorship
|
|
15
|
+
- authorship_year
|
|
16
|
+
- extinct
|
|
17
|
+
- field
|
|
18
|
+
- name_type
|
|
19
|
+
- nomenclatural_code
|
|
20
|
+
- nomenclatural_status
|
|
21
|
+
- origin
|
|
22
|
+
- secondary_source
|
|
23
|
+
- sector_dataset_id
|
|
24
|
+
- sector_mode
|
|
25
|
+
- status
|
|
26
|
+
- taxonomic_group
|
|
27
|
+
|
|
3
28
|
## [0.1.5] - 2025-03-25
|
|
4
29
|
- Added usage_id to nameusage_search
|
|
5
30
|
|
data/colrapi.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.description = "colrapi (a play on Kholrabi) is a low-level wrapper around the Catalog of Life API."
|
|
13
13
|
s.homepage = "https://github.com/SpeciesFileGroup/colrapi"
|
|
14
14
|
s.license = "MIT"
|
|
15
|
-
s.required_ruby_version = ">= 2.5.0"
|
|
15
|
+
s.required_ruby_version = [">= 2.5.0", "< 5.0"]
|
|
16
16
|
|
|
17
17
|
# s.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
|
18
18
|
|
|
@@ -32,7 +32,6 @@ Gem::Specification.new do |s|
|
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
|
33
33
|
# s.add_dependency "example-gem", "~> 1.0"
|
|
34
34
|
|
|
35
|
-
s.add_development_dependency "bundler", "~> 2.1", ">= 2.1.4"
|
|
36
35
|
s.add_development_dependency "rake", "~> 13.0", ">= 13.0.1"
|
|
37
36
|
s.add_development_dependency "test-unit", "~> 3.3", ">= 3.3.6"
|
|
38
37
|
s.add_development_dependency "vcr", "~> 6.0"
|
|
@@ -40,7 +39,7 @@ Gem::Specification.new do |s|
|
|
|
40
39
|
s.add_development_dependency "rexml", "~> 3.3", ">= 3.3.6"
|
|
41
40
|
|
|
42
41
|
s.add_runtime_dependency "faraday", "~> 2.2"
|
|
43
|
-
s.add_runtime_dependency "faraday-follow_redirects", ">= 0.1", "< 0.
|
|
42
|
+
s.add_runtime_dependency "faraday-follow_redirects", ">= 0.1", "< 0.6"
|
|
44
43
|
s.add_runtime_dependency "multi_json", "~> 1.15"
|
|
45
44
|
|
|
46
45
|
# s.add_runtime_dependency "thor", "~> 1.0", ">= 1.0.1"
|
data/lib/colrapi/request.rb
CHANGED
|
@@ -18,14 +18,18 @@ module Colrapi
|
|
|
18
18
|
@regexp = args[:regexp]
|
|
19
19
|
@content = Array(args[:content]) if args[:content]
|
|
20
20
|
@name = args[:name]
|
|
21
|
-
@authorship = args[:authorship]
|
|
22
|
-
@
|
|
21
|
+
@authorship = Array(args[:authorship]) if args[:authorship]
|
|
22
|
+
@authorship_year = Array(args[:authorship_year]) if args[:authorship_year]
|
|
23
|
+
@code = Array(args[:code]) if args[:code]
|
|
24
|
+
@nomenclatural_code = Array(args[:nomenclatural_code]) if args[:nomenclatural_code] # unfortunately code and nom_code get used on different endpoints
|
|
25
|
+
@field = Array(args[:field]) if args[:field]
|
|
23
26
|
@type = Array(args[:type]) if args[:type]
|
|
24
27
|
@rank = Array(args[:rank]) if args[:rank]
|
|
25
28
|
@facet = Array(args[:facet]) if args[:facet]
|
|
29
|
+
@extinct = Array(args[:extinct]) if args[:extinct]
|
|
26
30
|
@min_rank = args[:min_rank]
|
|
27
31
|
@max_rank = args[:max_rank]
|
|
28
|
-
@environment = args[:environment]
|
|
32
|
+
@environment = Array(args[:environment]) if args[:environment]
|
|
29
33
|
@highest_taxon_id = args[:highest_taxon_id]
|
|
30
34
|
@usage_id = args[:usage_id]
|
|
31
35
|
@parent_rank = args[:parent_rank]
|
|
@@ -43,6 +47,7 @@ module Colrapi
|
|
|
43
47
|
@has_gbif_id = args[:has_gbif_id]
|
|
44
48
|
@gbif_id = args[:gbif_id]
|
|
45
49
|
@gbif_publisher_id = args[:gbif_publisher_id]
|
|
50
|
+
@taxonomic_group = Array(args[:taxonomic_group]) if args[:taxonomic_group]
|
|
46
51
|
@editor = args[:editor]
|
|
47
52
|
@reviewer = args[:reviewer]
|
|
48
53
|
@modified_by = args[:modified_by]
|
|
@@ -64,6 +69,12 @@ module Colrapi
|
|
|
64
69
|
@min = args[:min]
|
|
65
70
|
@max = args[:max]
|
|
66
71
|
@min_size = args[:min_size]
|
|
72
|
+
@name_type = Array(args[:name_type]) if args[:name_type]
|
|
73
|
+
@nomenclatural_status = Array(args[:nomenclatural_status]) if args[:nomenclatural_status]
|
|
74
|
+
@status = Array(args[:status]) if args[:status]
|
|
75
|
+
@sector_mode = Array(args[:sector_mode]) if args[:sector_mode]
|
|
76
|
+
@sector_dataset_id = Array(args[:sector_dataset_id]) if args[:sector_dataset_id]
|
|
77
|
+
@secondary_source = Array(args[:secondary_source]) if args[:secondary_source]
|
|
67
78
|
@size = args[:size]
|
|
68
79
|
@within_superkingdom = args[:within_superkingdom]
|
|
69
80
|
@within_kingdom = args[:within_kingdom]
|
|
@@ -97,7 +108,6 @@ module Colrapi
|
|
|
97
108
|
@reverse = args[:reverse]
|
|
98
109
|
@limit = args[:limit]
|
|
99
110
|
@offset = args[:offset]
|
|
100
|
-
@status = args[:status]
|
|
101
111
|
@state = Array(args[:state]) if args[:state]
|
|
102
112
|
@running = args[:running]
|
|
103
113
|
@user = args[:user]
|
|
@@ -108,16 +118,19 @@ module Colrapi
|
|
|
108
118
|
|
|
109
119
|
def perform
|
|
110
120
|
|
|
111
|
-
args = { q: @q, regex: @regexp, attempt: @attempt, content: @content, name: @name, authorship: @authorship,
|
|
121
|
+
args = { q: @q, regex: @regexp, attempt: @attempt, content: @content, name: @name, authorship: @authorship,
|
|
122
|
+
authorshipYear: @authorship_year, code: @code, nomCode: @nomenclatural_code, field: @field, extinct: @extinct, type: @type,
|
|
112
123
|
rank: @rank, minRank: @min_rank, maxRank: @max_rank, parentRank: @parent_rank, projectKey: @project_id,
|
|
113
124
|
term: @term, termOp: @term_operator, status: @status, decisionMode: @decision_mode,
|
|
114
125
|
alias: @short_title, private: @private, releasedFrom: @released_from, contributesTo: @contributes_to,
|
|
115
|
-
hasSourceDataset: @has_source_dataset, hasGbifKey: @has_gbif_id, gbifKey: @gbif_id,
|
|
126
|
+
hasSourceDataset: @has_source_dataset, hasGbifKey: @has_gbif_id, group: @taxonomic_group, gbifKey: @gbif_id,
|
|
116
127
|
gbifPublisherKey: @gbif_publisher_id, editor: @editor, reviewer: @reviewer, modifiedBy: @modified_by,
|
|
117
128
|
id: @id, format: @format, root: @root_id, root2: @root2_id, synonyms: @include_synonyms,
|
|
118
129
|
showParent: @include_parent, origin: @origin, original: @original, license: @license, rowType: @row_type,
|
|
119
130
|
created: @created_after, createdBefore: @created_before, issued: @issued, issuedBefore: @issued_before,
|
|
120
131
|
modified: @modified_after, modifiedBefore: @modified_before, lastSync: @last_synced_before,
|
|
132
|
+
nomStatus: @nomenclatural_status, nameType: @name_type,
|
|
133
|
+
sectorMode: @sector_mode, sectorDatasetKey: @sector_dataset_id, secondarySourceGroup: @secondary_source,
|
|
121
134
|
minSize: @min_size, size: @size, issue: @issue, min: @min, max: @max, datasetKey: @dataset_id_filter,
|
|
122
135
|
withoutData: @without_data, superkingdom: @within_superkingdom, kingdom: @within_kingdom,
|
|
123
136
|
subkingdom: @within_subkingdom, superphylum: @within_superphylum, phylum: @within_phylum,
|
data/lib/colrapi/version.rb
CHANGED
data/lib/colrapi.rb
CHANGED
|
@@ -543,20 +543,33 @@ module Colrapi
|
|
|
543
543
|
|
|
544
544
|
# Search the nameusage route, which uses Elastic Search
|
|
545
545
|
#
|
|
546
|
-
# @param
|
|
546
|
+
# @param authorship [Array, String, nil] filters by authorship
|
|
547
|
+
# @param authorship_year [Array, String, nil] filters by authorship year
|
|
548
|
+
# @param content [Array, String, nil] restrict search to SCIENTIFIC_NAME, or AUTHORSHIP
|
|
547
549
|
# @param dataset_id [String, nil] restricts name usage search within a dataset
|
|
548
550
|
# @param endpoint [String, nil] some endpoints have nested options
|
|
549
|
-
# @param content [Array, String, nil] restrict search to SCIENTIFIC_NAME, or AUTHORSHIP
|
|
550
|
-
# @param issue [Array, String, nil] the data quality issue
|
|
551
|
-
# @param type [String, nil] sets the type of search to PREFIX, WHOLE_WORDS, or EXACT
|
|
552
|
-
# @param rank [String, nil] taxonomic rank of name usages
|
|
553
|
-
# @param min_rank [String, nil] minimum taxonomic rank of name usages
|
|
554
|
-
# @param max_rank [String, nil] maximum taxonomic rank of name usages
|
|
555
|
-
# @param facet [Array, String, nil] the search facet
|
|
556
551
|
# @param environment [Array, String, nil] filter by environment (MARINE, TERRESTRIAL, FRESHWATER, BRACKISH)
|
|
552
|
+
# @param extinct [Array, int, nil] filter by extinct status (0, 1)
|
|
553
|
+
# @param facet [Array, String, nil] the search facet
|
|
554
|
+
# @param field [Array, String, nil] filter by name field (see: http://api.checklistbank.org/vocab/namefield)
|
|
557
555
|
# @param highest_taxon_id [String, nil] Filter by highest taxon ID
|
|
556
|
+
# @param issue [Array, String, nil] the data quality issue
|
|
557
|
+
# @param max_rank [String, nil] maximum taxonomic rank of name usages
|
|
558
|
+
# @param min_rank [String, nil] minimum taxonomic rank of name usages
|
|
559
|
+
# @param name_type [Array, String, nil] filter by name type (hybrid formula, informal, no name, otu, placeholder, scientific, virus)
|
|
560
|
+
# @param nomenclatural_code [Array, String, nil] filter by nomenclatural code (botanical, zoological, bacterial, viral, phytosociological, cultivars)
|
|
561
|
+
# @param nomenclatural_status [Array, String, nil] filter by nomenclatural status (acceptable, conserved, doubtful, established, manuscript, not established, rejected, unacceptable)
|
|
562
|
+
# @param origin [Array, String, nil] filter by origin of the name usage (see: http://api.checklistbank.org/vocab/origin)
|
|
563
|
+
# @param q [String] A query string
|
|
564
|
+
# @param rank [Array, String, nil] taxonomic rank of name usages
|
|
565
|
+
# @param secondary_source [Array, String, nil] filter by secondary source (authorship, basionym, extinct, holotype, parent, published in, rank, temporal range)
|
|
566
|
+
# @param sector_dataset_id [Array, String, nil] filter by the sector source dataset ID
|
|
567
|
+
# @param sector_mode [Array, String, nil] filter by the sector mode (attach, merge, union)
|
|
568
|
+
# @param status [Array, String, nil] filter by taxonomic status (accepted, ambiguous synonym, misapplied, provisionally accepted, synonym)
|
|
569
|
+
# @param taxonomic_group [Array, String, nil] filter by taxonomic group (see: http://api.checklistbank.org/vocab/taxgroup)
|
|
570
|
+
# @param type [String, nil] sets the type of search to PREFIX, WHOLE_WORDS, or EXACT
|
|
558
571
|
# @param usage_id [String, nil] Filter by usage ID
|
|
559
|
-
#
|
|
572
|
+
#
|
|
560
573
|
# @param sort_by [String, nil] sort results by NAME, TAXONOMIC, INDEX_NAME_ID, NATIVE, or RELEVANCE
|
|
561
574
|
# @param reverse [Boolean] sort in reverse order
|
|
562
575
|
# @param offset [Integer] Offset for pagination
|
|
@@ -564,20 +577,29 @@ module Colrapi
|
|
|
564
577
|
# @param verbose [Boolean] Print headers to STDOUT
|
|
565
578
|
#
|
|
566
579
|
# @return [Array, Boolean] An array of hashes
|
|
567
|
-
def self.nameusage_search(q: nil,
|
|
580
|
+
def self.nameusage_search(q: nil, authorship: nil, authorship_year: nil, dataset_id: nil,
|
|
581
|
+
endpoint: 'nameusage/search', extinct: nil, field: nil, content: nil, issue: nil,
|
|
568
582
|
type: nil, rank: nil, min_rank: nil, max_rank: nil, environment: nil, facet: nil,
|
|
569
|
-
|
|
570
|
-
|
|
583
|
+
nomenclatural_code: nil, highest_taxon_id: nil, usage_id: nil, nomenclatural_status: nil,
|
|
584
|
+
name_type: nil, origin: nil, secondary_source: nil,
|
|
585
|
+
sector_mode: nil, sector_dataset_id: nil, status: nil, taxonomic_group: nil,
|
|
586
|
+
sort_by: nil, reverse: nil, offset: nil, limit: nil, verbose: false)
|
|
571
587
|
|
|
572
588
|
# a nil dataset_id will search name usages from all datasets in ChecklistBank
|
|
573
589
|
unless dataset_id.nil?
|
|
574
590
|
endpoint = "dataset/#{dataset_id}/nameusage/search"
|
|
575
591
|
end
|
|
576
592
|
|
|
577
|
-
Request.new(endpoint: endpoint, q: q,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
593
|
+
Request.new(endpoint: endpoint, q: q, authorship: authorship, authorship_year: authorship_year,
|
|
594
|
+
extinct: extinct, field: field, content: content, issue: issue, type: type,
|
|
595
|
+
rank: rank, min_rank: min_rank, max_rank: max_rank, facet: facet,
|
|
596
|
+
nomenclatural_code: nomenclatural_code,environment: environment,
|
|
597
|
+
highest_taxon_id: highest_taxon_id, usage_id: usage_id,
|
|
598
|
+
name_type: name_type, nomenclatural_status: nomenclatural_status, origin: origin,
|
|
599
|
+
secondary_source: secondary_source, sector_mode: sector_mode,
|
|
600
|
+
sector_dataset_id: sector_dataset_id, status: status, taxonomic_group: taxonomic_group,
|
|
601
|
+
sort_by: sort_by, reverse: reverse, offset: offset, limit: limit,
|
|
602
|
+
verbose: verbose).perform
|
|
581
603
|
end
|
|
582
604
|
|
|
583
605
|
# Get a name usage suggestion
|
metadata
CHANGED
|
@@ -1,35 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: colrapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Yoder, Geoff Ower
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: bundler
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.1'
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 2.1.4
|
|
23
|
-
type: :development
|
|
24
|
-
prerelease: false
|
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
-
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '2.1'
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 2.1.4
|
|
33
12
|
- !ruby/object:Gem::Dependency
|
|
34
13
|
name: rake
|
|
35
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -141,7 +120,7 @@ dependencies:
|
|
|
141
120
|
version: '0.1'
|
|
142
121
|
- - "<"
|
|
143
122
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0.
|
|
123
|
+
version: '0.6'
|
|
145
124
|
type: :runtime
|
|
146
125
|
prerelease: false
|
|
147
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -151,7 +130,7 @@ dependencies:
|
|
|
151
130
|
version: '0.1'
|
|
152
131
|
- - "<"
|
|
153
132
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: '0.
|
|
133
|
+
version: '0.6'
|
|
155
134
|
- !ruby/object:Gem::Dependency
|
|
156
135
|
name: multi_json
|
|
157
136
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -198,8 +177,7 @@ licenses:
|
|
|
198
177
|
metadata:
|
|
199
178
|
homepage_uri: https://github.com/SpeciesFileGroup/colrapi
|
|
200
179
|
source_code_uri: https://github.com/SpeciesFileGroup/colrapi
|
|
201
|
-
changelog_uri: https://github.com/SpeciesFileGroup/colrapi/releases/tag/v0.1.
|
|
202
|
-
post_install_message:
|
|
180
|
+
changelog_uri: https://github.com/SpeciesFileGroup/colrapi/releases/tag/v0.1.7
|
|
203
181
|
rdoc_options: []
|
|
204
182
|
require_paths:
|
|
205
183
|
- lib
|
|
@@ -208,14 +186,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
208
186
|
- - ">="
|
|
209
187
|
- !ruby/object:Gem::Version
|
|
210
188
|
version: 2.5.0
|
|
189
|
+
- - "<"
|
|
190
|
+
- !ruby/object:Gem::Version
|
|
191
|
+
version: '5.0'
|
|
211
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
193
|
requirements:
|
|
213
194
|
- - ">="
|
|
214
195
|
- !ruby/object:Gem::Version
|
|
215
196
|
version: '0'
|
|
216
197
|
requirements: []
|
|
217
|
-
rubygems_version:
|
|
218
|
-
signing_key:
|
|
198
|
+
rubygems_version: 4.0.3
|
|
219
199
|
specification_version: 4
|
|
220
200
|
summary: Catalog of Life Client
|
|
221
201
|
test_files: []
|