Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
48f934a
modified http delete API to allow for more flexible input (multiple i…
mdorf Sep 10, 2025
c2123d5
Add Ruby 3.2 to the test matrix
jvendetti Oct 13, 2025
2d06fdc
Bump minitest from 5.25.4 to 5.26.0
jvendetti Oct 13, 2025
78e7fbf
Bump rubocop from 1.71.2 to 1.81.1
jvendetti Oct 13, 2025
ce2f9d1
Bump rake from 13.2.1 to 13.3.0
jvendetti Oct 13, 2025
36db6a4
Bump activesupport from 7.2.2.1 to 8.0.3
jvendetti Oct 16, 2025
2229d3a
Use latest version of bundler
jvendetti Oct 16, 2025
50489f0
critical bug fix to the bulk delete method
mdorf Nov 5, 2025
af06fc6
improved URL comparison handling in test_purl_obo
mdorf Nov 6, 2025
459e54d
Merge pull request #44 from ncbo/feature/enhanced-http-delete
alexskr Nov 7, 2025
346a556
chore: bump version to 2.7.0
alexskr Nov 7, 2025
08f4ff4
Gemfile.lock update
alexskr Nov 7, 2025
ec35613
Add code coverage
alexskr Nov 8, 2025
4e5c0d8
add codecov token
alexskr Nov 8, 2025
d7dac14
Merge pull request #46 from ncbo/ci/simplecov-codecov-integration
alexskr Nov 8, 2025
e1d9a93
fixed merge of headers for http.get
mdorf Nov 10, 2025
cfe0374
Merge pull request #47 from ncbo/feature/enhanced-http-delete
alexskr Nov 10, 2025
371520f
chore: bump version to v2.7.1
alexskr Nov 10, 2025
f992b18
Gemfile.lock update
alexskr Nov 10, 2025
542cbb4
Merge branch 'master' into upgrade/ruby-3.2.9
jvendetti Nov 19, 2025
81d75d6
Fix RuboCop warnings
jvendetti Nov 19, 2025
685bf52
Remove Ruby 3.1 from the text matrix
jvendetti Jan 9, 2026
fbc8106
Skip some purl related tests (for now)
jvendetti Jan 9, 2026
5cfe363
Update license copyright year
jvendetti Jan 9, 2026
40c3a80
Add contributor images
jvendetti Jan 9, 2026
fbb53c7
Update README.md
jvendetti Jan 9, 2026
dde3862
Increase version to 2.8.0
jvendetti Jan 9, 2026
67f3b05
Merge pull request #48 from ncbo/upgrade/ruby-3.2.9
jvendetti Jan 9, 2026
02c9d61
Fix nil error in Analytics.last_month when ontology data is missing
jvendetti Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ name: Ruby

on:
push:
branches:
- '**' # run on all branches
tags-ignore:
- '**' # skip all tags
pull_request_target:
types: [opened, reopened]
types: [opened, reopened, synchronize]

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['3.1']
ruby-version: ['3.2']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
Expand All @@ -30,8 +33,14 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: set up config file
run: cp config/config.test.rb config/config.rb
run: cp config/config.test.rb config/config.rb
- name: Run tests
env:
UT_APIKEY: ${{ secrets.UT_APIKEY }}
run: bundle exec rake test TESTOPTS="-v"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.ruby-version }}
verbose: true
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
*.gem
.DS_Store
config/config.rb
/config/config.rb

# Specific to IntelliJ
.idea/

# Specific to rbenv
.ruby-version
.ruby-version

# Codecov local cache
/coverage/
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ gemspec

gem 'pry'
gem 'rake'
gem 'rubocop', '~> 1.43'
gem 'rubocop', '~> 1.81'
gem 'simplecov', require: false
gem 'simplecov-cobertura', require: false
106 changes: 61 additions & 45 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
ontologies_api_client (2.5.3)
activesupport (= 7.2.2.1)
ontologies_api_client (2.8.0)
activesupport (= 8.0.3)
addressable (~> 2.8)
excon
faraday
Expand All @@ -15,7 +15,7 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.2.1)
activesupport (8.0.3)
base64
benchmark (>= 0.3)
bigdecimal
Expand All @@ -27,96 +27,112 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
ast (2.4.3)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (3.3.1)
coderay (1.1.3)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
drb (2.2.1)
excon (1.2.3)
faraday (2.12.2)
connection_pool (2.5.4)
docile (1.4.1)
drb (2.2.3)
excon (1.3.1)
logger
faraday (2.14.0)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-excon (2.3.0)
faraday-excon (2.4.0)
excon (>= 1.0.0)
faraday (>= 2.11.0, < 3)
faraday-follow_redirects (0.3.0)
faraday-follow_redirects (0.4.0)
faraday (>= 1, < 3)
faraday-multipart (1.1.0)
faraday-multipart (1.1.1)
multipart-post (~> 2.0)
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
faraday-net_http (3.4.2)
net-http (~> 0.5)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.9.1)
language_server-protocol (3.17.0.4)
logger (1.6.5)
json (2.16.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
lz4-ruby (0.3.3)
method_source (1.1.0)
minitest (5.25.4)
minitest (5.26.2)
minitest-hooks (1.5.2)
minitest (> 5.3)
multi_json (1.15.0)
multi_json (1.17.0)
multipart-post (2.4.1)
net-http (0.6.0)
uri
oj (3.16.9)
net-http (0.8.0)
uri (>= 0.11.1)
oj (3.16.12)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
ostruct (0.6.1)
parallel (1.26.3)
parser (3.3.7.1)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prism (1.6.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (6.0.1)
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.10.0)
rubocop (1.71.2)
rake (13.3.1)
regexp_parser (2.11.3)
rexml (3.4.4)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-ast (1.48.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (3.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.1)

PLATFORMS
arm64-darwin-24
ruby
x86_64-darwin-16
x86_64-darwin-17
x86_64-linux

DEPENDENCIES
faraday-follow_redirects (~> 0.3)
minitest (~> 5.25)
minitest (~> 5.26)
minitest-hooks (~> 1.5)
ontologies_api_client!
pry
rake
rubocop (~> 1.43)
rubocop (~> 1.81)
simplecov
simplecov-cobertura

BUNDLED WITH
2.5.11
2.7.2
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025, The Board of Trustees of Leland Stanford Junior University
Copyright (c) 2026, The Board of Trustees of Leland Stanford Junior University
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ Resources that should have save, update, and delete methods will need to include

For questions please email [support@bioontology.org](support@bioontology.org.)

## License
## Contributors
<a href="https://github.com/ncbo/ontologies_api_ruby_client/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ncbo/ontologies_api_ruby_client" />
</a>

This project is licensed under the [FreeBSD License](LICENSE.txt) © 2025 The Board of Trustees of Leland Stanford Junior University.
## License
The 2-Clause BSD License. See [LICENSE.txt](LICENSE.txt) for more information.
7 changes: 6 additions & 1 deletion lib/ontologies_api_client/analytics.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module LinkedData::Client
class Analytics
HTTP = LinkedData::Client::HTTP
LOGGER = Logger.new($stdout)

attr_accessor :onts, :date

Expand All @@ -18,7 +19,11 @@ def self.last_month
analytics.delete(:context)
onts = []
analytics.keys.each do |ont|
views = analytics[ont][:"#{year_num}"][:"#{month_num}"]
views = analytics.dig(ont, :"#{year_num}", :"#{month_num}")
if views.nil?
LOGGER.debug("Analytics data missing for ontology: #{ont}, year: #{year_num}, month: #{month_num}")
views = 0
end
onts << {ont: ont, views: views}
end
data.onts = onts
Expand Down
50 changes: 41 additions & 9 deletions lib/ontologies_api_client/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def self.get(path, params = {}, options = {})
req.url path
req.params = params.dup
req.options[:timeout] = 60
req.headers.merge(headers)
req.headers.merge!(headers)
req.headers[:invalidate_cache] = invalidate_cache
end
rescue StandardError => e
Expand Down Expand Up @@ -144,18 +144,50 @@ def self.patch(path, obj)
response
end

def self.delete(id)
puts "Deleting #{id}" if $DEBUG_API_CLIENT
response = conn.delete id
raise StandardError, response.body if response.status >= 500

response
end

def self.object_from_json(json)
recursive_struct(load_json(json))
end

def self.delete(path, params = {}, options = {})
headers = options[:headers] || {}
raw = options[:raw] || false # return response.body (string)
parse = options[:parse] || false # return parsed object (similar to 'get')

params = (params || {}).dup
params = params.delete_if { |k, v| v.nil? || v.to_s.empty? }

begin
puts "Deleting #{path} with #{params}" if $DEBUG_API_CLIENT
response = conn.delete do |req|
req.url path
req.params = params.dup
req.options[:timeout] = options[:timeout] || 60
req.headers.merge!(headers)
end
rescue StandardError => e
query = Faraday::Utils.build_query(params)
pretty = path.dup
pretty += '?' unless query.empty? || pretty.include?('?')
raise e, "Problem deleting:\n#{pretty}#{query}\n\nError: #{e.message}\n#{e.backtrace.join("\n\t")}"
end

raise StandardError, response.body if response.status >= 500

if raw
response.body
elsif parse
if response.respond_to?(:parsed_body) && response.parsed_body
obj = response.parsed_body
obj = obj.dup if obj.frozen?
else
obj = recursive_struct(load_json(response.body))
end
obj
else
response # backward compatibility preserved
end
end

private

def self.custom_req(obj, file, file_attribute, req)
Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module LinkedData
module Client
VERSION = '2.5.3'
VERSION = '2.8.0'
end
end
4 changes: 2 additions & 2 deletions ontologies_api_client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']
gem.version = LinkedData::Client::VERSION

gem.add_dependency('activesupport', '7.2.2.1')
gem.add_dependency('activesupport', '8.0.3')
gem.add_dependency('addressable', '~> 2.8')
gem.add_dependency('excon')
gem.add_dependency('faraday')
Expand All @@ -29,6 +29,6 @@ Gem::Specification.new do |gem|
gem.add_dependency('oj')

gem.add_development_dependency('faraday-follow_redirects', '~> 0.3')
gem.add_development_dependency('minitest', '~> 5.25')
gem.add_development_dependency('minitest', '~> 5.26')
gem.add_development_dependency('minitest-hooks', '~> 1.5')
end
Loading
Loading