bok_choy 0.0.3 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c0f176e351a57af03be2b64c8f3b41e9dd16514057a230900424f0d08e28609
4
- data.tar.gz: c33e18c4b41338c1d58a916cc501810a4f27db0f1add72e550507a901adb7d2b
3
+ metadata.gz: 7e3c63c503bd9e51206ea7d6d854ecda2fbfaabc83c731a2b2affa805b9215cf
4
+ data.tar.gz: c193032071ef68f7d85544787e7d03ac525ab67c9940838cae7a45674d1cdcb3
5
5
  SHA512:
6
- metadata.gz: 579e78cfc22b095fe3b930e3a0ec630ea90668eafd88c2b16efa7766129a8cb0a87e32056575ac934f918167b050ab79169992d284619d21bf501fe8426ae31d
7
- data.tar.gz: f4d2363a3d23cbd93f4b5101752ee2ede20a97710078836e391833167eeda0ff1b12ccbba0d31515f5cce2236164c23006da2c4f9a2fda43aaaf1ef780bfd355
6
+ metadata.gz: 4dd25ad34de7f6ad7ec24a3d4834269b386ddfdf525c68075d895b04506752d551c7c19da820de3bb19e0920e5ee8155f4d7ab2a1161b95b1c721481729b3c9c
7
+ data.tar.gz: 00e3ee3cf9c92f5c5c98fccdfd49749800fe04f334e47d509568fb98d035c2ca16fb1be2d7962ebe263d4c6d4abe831bc8b46bdca9b2cfc892b4d6d2ead99cbe
@@ -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: 3.3.4
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,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.5] - 2026-06-18
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
+ - Added `rexml` and `irb` development dependencies (no longer in stdlib on Ruby 4)
10
+ - Fixed copy-paste residue: 503 error message said "Crossref is rate limiting your requests." (Crossref is the upstream serrano template's API) — changed to "BHLnames is rate limiting your requests."
11
+
12
+ ## [0.0.4] - 2025-10-28
13
+ - Updated license from NCSA to MIT
14
+ - Added item_page endpoint
15
+
3
16
  ## [0.0.3] - 2024-09-11
4
17
  - Removed Gemfile.lock
5
18
  - Bumped development depency versions to avoid CVE-2024-43398
data/LICENSE.txt CHANGED
@@ -1,13 +1,10 @@
1
- Copyright © 2023 Species File Group. All rights reserved.
1
+ The MIT License (MIT)
2
2
 
3
- Developed by: Species File Group
4
- Illinois Natural History Survey
5
- https://github.com/SpeciesFileGroup/bok_choy
3
+ Copyright © 2024 Species File Group
6
4
 
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
6
 
9
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
10
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.
11
- Neither the names of <Name of Development Group, Name of Institution>, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
10
 
13
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
data/README.md CHANGED
@@ -56,6 +56,19 @@ Get BHL item metadata by item ID:
56
56
  BokChoy.items(73397) # => Hash
57
57
  ```
58
58
 
59
+ ---
60
+ ### [Items page nums](https://bhlnames.globalnames.org/apidoc/index.html#/default/get-refs-by-item-page)
61
+ Get BHL page information by item_id and page_num:
62
+ ```ruby
63
+ BokChoy.items_page_nums(item_id: 15402, page_num: 191) # => Hash
64
+ ```
65
+ This corresponds with the identifiers in the BHL item endpoint URLs: [https://www.biodiversitylibrary.org/item/15402#page/191/mode/1up](https://www.biodiversitylibrary.org/item/15402#page/191/mode/1up)
66
+
67
+ The endpoint returns information about the page including the corresponding pageId and url:
68
+
69
+ [https://www.biodiversitylibrary.org/page/15402](https://www.biodiversitylibrary.org/page/747872)
70
+
71
+
59
72
  ---
60
73
  ### [Page reference metadata](https://bhlnames.globalnames.org/apidoc/index.html#/default/get-refs)
61
74
  Get BHL reference metadata by a page ID:
@@ -98,7 +111,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Specie
98
111
 
99
112
  ## License
100
113
 
101
- The gem is available as open source under the terms of the [NCSA/Illinois](https://github.com/SpeciesFileGroup/bok_choy/blob/main/LICENSE.txt) license. You can learn more about the NCSA license on [Wikipedia](https://en.wikipedia.org/wiki/University_of_Illinois/NCSA_Open_Source_License) and compare it with other open source licenses at the [Open Source Initiative](https://opensource.org/license/uoi-ncsa-php/).
114
+ The gem is available as open source under the terms of the [MIT license](https://github.com/SpeciesFileGroup/bok_choy/blob/main/LICENSE.txt). You can learn more about the MIT license on [Wikipedia](https://en.wikipedia.org/wiki/MIT_License) and compare it with other open source licenses at the [Open Source Initiative](https://opensource.org/license/mit/).
102
115
 
103
116
  ## Code of Conduct
104
117
 
data/bok_choy.gemspec CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.summary = "BHL Names Client"
12
12
  s.description = "Bok Choy is a low-level wrapper around the BHLnames API."
13
13
  s.homepage = "https://github.com/SpeciesFileGroup/bok_choy"
14
- s.license = "NCSA"
15
- s.required_ruby_version = ">= 2.5.0"
14
+ s.license = "MIT"
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 "codecov", "~> 0.5.0"
37
36
  # s.add_development_dependency "json", "~> 2.3", ">= 2.3.1"
38
37
  s.add_development_dependency "rake", "~> 13.0", ">= 13.0.1"
@@ -41,9 +40,11 @@ Gem::Specification.new do |s|
41
40
  s.add_development_dependency "test-unit", "~> 3.3", ">= 3.3.6"
42
41
  s.add_development_dependency "vcr", "~> 6.0"
43
42
  s.add_development_dependency "webmock", "~> 3.18"
43
+ s.add_development_dependency "rexml", "~> 3.3", ">= 3.3.6"
44
+ s.add_development_dependency "irb", "~> 1.0"
44
45
 
45
46
  s.add_runtime_dependency "faraday", "~> 2.2"
46
- s.add_runtime_dependency "faraday-follow_redirects", ">= 0.1", "< 0.4"
47
+ s.add_runtime_dependency "faraday-follow_redirects", ">= 0.1", "< 0.6"
47
48
  s.add_runtime_dependency "multi_json", "~> 1.15"
48
49
 
49
50
  # TODO: comment out
@@ -20,7 +20,7 @@ module Faraday
20
20
  when 502
21
21
  raise BokChoy::BadGateway, error_message_500(response, "The server returned an invalid or incomplete response.")
22
22
  when 503
23
- raise BokChoy::ServiceUnavailable, error_message_500(response, "Crossref is rate limiting your requests.")
23
+ raise BokChoy::ServiceUnavailable, error_message_500(response, "BHLnames is rate limiting your requests.")
24
24
  when 504
25
25
  raise BokChoy::GatewayTimeout, error_message_500(response, "504 Gateway Time-out")
26
26
  end
@@ -8,6 +8,8 @@ module BokChoy
8
8
  attr_accessor :endpoint
9
9
  attr_accessor :q
10
10
  attr_accessor :verbose
11
+ attr_accessor :item_id
12
+ attr_accessor :page_num
11
13
 
12
14
  attr_accessor :options
13
15
 
@@ -15,6 +17,8 @@ module BokChoy
15
17
  @endpoint = args[:endpoint]
16
18
  @verbose = args[:verbose]
17
19
  @q = args[:q]
20
+ @item_id = args[:item_id]
21
+ @page_num = args[:page_num]
18
22
  @json = args[:json].to_json
19
23
  @options = args[:options] # TODO: not added at bok_choy.rb
20
24
  end
@@ -22,9 +26,12 @@ module BokChoy
22
26
  def perform
23
27
 
24
28
  args = {
25
- json: @json
29
+ json: @json,
30
+ item_id: @item_id,
31
+ page_num: @page_num
26
32
  }
27
33
  opts = args.delete_if { |_k, v| v.nil? }
34
+ opts = args.delete_if { |_k, v| v == 'null' }
28
35
 
29
36
  Faraday::Utils.default_space_encoding = "+"
30
37
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BokChoy
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.5"
5
5
  end
data/lib/bok_choy.rb CHANGED
@@ -50,6 +50,20 @@ module BokChoy
50
50
  Request.new(endpoint: endpoint, verbose: verbose).perform
51
51
  end
52
52
 
53
+ # Get a page by item ID and page number
54
+ #
55
+ # @param item_id [String] A BHL item ID
56
+ # @param page_num [String] A BHL page number
57
+ # @param verbose [Boolean] Print headers to STDOUT
58
+ #
59
+ # @return [Hash] A result hash
60
+ def self.items_page_nums(item_id: nil, page_num: nil, verbose: false)
61
+ raise "Item ID and page number required" if item_id.nil? || page_num.nil?
62
+
63
+ endpoint = "items_page_nums"
64
+ Request.new(endpoint: endpoint, item_id: item_id, page_num: page_num, verbose: verbose).perform
65
+ end
66
+
53
67
  # Get metadata and taxonomic statistics for a BHL item
54
68
  #
55
69
  # @param id [String] A BHL item ID
metadata CHANGED
@@ -1,35 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bok_choy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Ower, Matt Yoder
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-11 00:00:00.000000000 Z
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
@@ -98,6 +77,40 @@ dependencies:
98
77
  - - "~>"
99
78
  - !ruby/object:Gem::Version
100
79
  version: '3.18'
80
+ - !ruby/object:Gem::Dependency
81
+ name: rexml
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '3.3'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 3.3.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.3'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 3.3.6
100
+ - !ruby/object:Gem::Dependency
101
+ name: irb
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '1.0'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '1.0'
101
114
  - !ruby/object:Gem::Dependency
102
115
  name: faraday
103
116
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +134,7 @@ dependencies:
121
134
  version: '0.1'
122
135
  - - "<"
123
136
  - !ruby/object:Gem::Version
124
- version: '0.4'
137
+ version: '0.6'
125
138
  type: :runtime
126
139
  prerelease: false
127
140
  version_requirements: !ruby/object:Gem::Requirement
@@ -131,7 +144,7 @@ dependencies:
131
144
  version: '0.1'
132
145
  - - "<"
133
146
  - !ruby/object:Gem::Version
134
- version: '0.4'
147
+ version: '0.6'
135
148
  - !ruby/object:Gem::Dependency
136
149
  name: multi_json
137
150
  requirement: !ruby/object:Gem::Requirement
@@ -187,12 +200,11 @@ files:
187
200
  - lib/bok_choy/version.rb
188
201
  homepage: https://github.com/SpeciesFileGroup/bok_choy
189
202
  licenses:
190
- - NCSA
203
+ - MIT
191
204
  metadata:
192
205
  homepage_uri: https://github.com/SpeciesFileGroup/bok_choy
193
206
  source_code_uri: https://github.com/SpeciesFileGroup/bok_choy
194
- changelog_uri: https://github.com/SpeciesFileGroup/bok_choy/releases/tag/v0.0.3
195
- post_install_message:
207
+ changelog_uri: https://github.com/SpeciesFileGroup/bok_choy/releases/tag/v0.0.5
196
208
  rdoc_options: []
197
209
  require_paths:
198
210
  - lib
@@ -201,14 +213,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
213
  - - ">="
202
214
  - !ruby/object:Gem::Version
203
215
  version: 2.5.0
216
+ - - "<"
217
+ - !ruby/object:Gem::Version
218
+ version: '5.0'
204
219
  required_rubygems_version: !ruby/object:Gem::Requirement
205
220
  requirements:
206
221
  - - ">="
207
222
  - !ruby/object:Gem::Version
208
223
  version: '0'
209
224
  requirements: []
210
- rubygems_version: 3.5.11
211
- signing_key:
225
+ rubygems_version: 4.0.3
212
226
  specification_version: 4
213
227
  summary: BHL Names Client
214
228
  test_files: []