From 4794df610d0b2abb1ccec61007af44c58db04544 Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Wed, 5 Mar 2025 15:15:24 -0800 Subject: [PATCH 1/5] Fix "can't modify frozen String" error --- lib/ontologies_api_client/http.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ontologies_api_client/http.rb b/lib/ontologies_api_client/http.rb index b0a4355..64080c3 100644 --- a/lib/ontologies_api_client/http.rb +++ b/lib/ontologies_api_client/http.rb @@ -74,7 +74,7 @@ def self.get(path, params = {}, options = {}) end rescue Exception => e params = Faraday::Utils.build_query(params) - path << "?" unless params.empty? || path.include?("?") + path += "?" unless params.empty? || path.include?("?") raise e, "Problem retrieving:\n#{path}#{params}\n\nError: #{e.message}\n#{e.backtrace.join("\n\t")}" end From 1a205de640a14933d99a2dc5d4b1f8c7980ed7e1 Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Wed, 5 Mar 2025 15:27:38 -0800 Subject: [PATCH 2/5] Fix some RuboCop warnings --- lib/ontologies_api_client/http.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/ontologies_api_client/http.rb b/lib/ontologies_api_client/http.rb index 64080c3..7e1622c 100644 --- a/lib/ontologies_api_client/http.rb +++ b/lib/ontologies_api_client/http.rb @@ -46,8 +46,8 @@ class Link < String def self.conn unless LinkedData::Client.connection_configured? - if Kernel.const_defined?("Rails") - rails = Kernel.const_get("Rails") + if Kernel.const_defined?('Rails') + rails = Kernel.const_get('Rails') store = rails.cache if rails.cache end LinkedData::Client.config_connection(cache_store: store) @@ -58,7 +58,7 @@ def self.conn def self.get(path, params = {}, options = {}) headers = options[:headers] || {} raw = options[:raw] || false # return the unparsed body of the request - params = params.delete_if { |k, v| v == nil || v.to_s.empty? } + params = params.delete_if { |k, v| v.nil? || v.to_s.empty? } params[:ncbo_cache_buster] = Time.now.to_f if raw # raw requests don't get cached to ensure body is available invalidate_cache = params.delete(:invalidate_cache) || false @@ -72,9 +72,9 @@ def self.get(path, params = {}, options = {}) req.headers.merge(headers) req.headers[:invalidate_cache] = invalidate_cache end - rescue Exception => e + rescue StandardError => e params = Faraday::Utils.build_query(params) - path += "?" unless params.empty? || path.include?("?") + path += '?' unless params.empty? || path.include?('?') raise e, "Problem retrieving:\n#{path}#{params}\n\nError: #{e.message}\n#{e.backtrace.join("\n\t")}" end @@ -163,14 +163,14 @@ def self.custom_req(obj, file, file_attribute, req) if file # multipart - boundary = "OntologiesAPIMultipartPost" + boundary = 'OntologiesAPIMultipartPost' req.headers['Content-Type'] = "multipart/mixed; boundary=#{boundary}; type=application/json; start=json" parts = [] parts << Faraday::Parts::Part.new(boundary, "json\"\r\nContent-Type: \"application/json; charset=UTF-8", MultiJson.dump(obj)) parts << Faraday::Parts::Part.new(boundary, file_attribute, file) parts << Faraday::Parts::EpiloguePart.new(boundary) req.body = Faraday::CompositeReadIO.new(parts) - req.headers["Content-Length"] = req.body.length.to_s + req.headers['Content-Length'] = req.body.length.to_s else # normal req.body = MultiJson.dump(obj) @@ -187,7 +187,7 @@ def self.params_file_handler(params) next unless value.is_a?(File) || value.is_a?(Tempfile) || value.is_a?(ActionDispatch::Http::UploadedFile) filename = value.original_filename - file = Faraday::UploadIO.new(value.path, "text/plain", filename) + file = Faraday::UploadIO.new(value.path, 'text/plain', filename) return_attribute = attribute params.delete(attribute) end @@ -211,9 +211,9 @@ def self.recursive_struct(json_obj) if json_obj.is_a?(Hash) return if json_obj.empty? - value_cls = LinkedData::Client::Base.class_for_type(json_obj["@type"]) + value_cls = LinkedData::Client::Base.class_for_type(json_obj['@type']) links = prep_links(json_obj) # strip links - context = json_obj.delete("@context") # strip context + context = json_obj.delete('@context') # strip context # Create a struct with the left-over attributes to store data attributes = json_obj.keys.map { |k| k.to_sym } @@ -224,7 +224,7 @@ def self.recursive_struct(json_obj) if value_cls instance = value_cls.new attributes.each do |attr| - attr = attr[1..-1] if attr[0].eql?("@") + attr = attr[1..-1] if attr[0].eql?('@') instance.class.class_eval do unless method_defined?(attr.to_sym) define_method attr.to_sym do @@ -241,7 +241,7 @@ def self.recursive_struct(json_obj) # Create objects for each key/value pair, recursively json_obj.each do |attr, value| - attr = attr[1..-1] if attr[0].eql?("@") + attr = attr[1..-1] if attr[0].eql?('@') instance.instance_variable_set("@#{attr}", recursive_struct(value)) end else @@ -271,7 +271,7 @@ def self.prep_links(obj) links = obj.delete(LinkedData::Client.settings.links_attr) return if links.nil? - context = links.delete("@context") + context = links.delete('@context') return if context.nil? links.keys.each do |link_type| From c580be518edc71453a274a022295cfc9e6daa875 Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Wed, 5 Mar 2025 17:22:43 -0800 Subject: [PATCH 3/5] Increase version to 2.5.2 --- Gemfile.lock | 2 +- lib/ontologies_api_client/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 241d1b7..87062b4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ontologies_api_client (2.5.0) + ontologies_api_client (2.5.2) activesupport (= 7.0.8) addressable (~> 2.8) excon diff --git a/lib/ontologies_api_client/version.rb b/lib/ontologies_api_client/version.rb index f433cf8..2715feb 100644 --- a/lib/ontologies_api_client/version.rb +++ b/lib/ontologies_api_client/version.rb @@ -2,6 +2,6 @@ module LinkedData module Client - VERSION = '2.5.0' + VERSION = '2.5.2' end end From 44d5fd0c8d3e5f629ebca23b42f8994de1a43a78 Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Tue, 1 Apr 2025 17:12:31 -0700 Subject: [PATCH 4/5] Bump activesupport from 7.0.8 to 7.2.2.1 --- Gemfile.lock | 20 ++++++++++++++++---- ontologies_api_client.gemspec | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 87062b4..de44ca3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: ontologies_api_client (2.5.2) - activesupport (= 7.0.8) + activesupport (= 7.2.2.1) addressable (~> 2.8) excon faraday @@ -15,17 +15,28 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.0.8) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) 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) 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) faraday-net_http (>= 2.0, < 3.5) @@ -83,6 +94,7 @@ GEM rubocop-ast (1.38.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) + securerandom (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (3.1.4) diff --git a/ontologies_api_client.gemspec b/ontologies_api_client.gemspec index 8e2ec66..a95da6c 100644 --- a/ontologies_api_client.gemspec +++ b/ontologies_api_client.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.version = LinkedData::Client::VERSION - gem.add_dependency('activesupport', '7.0.8') + gem.add_dependency('activesupport', '7.2.2.1') gem.add_dependency('addressable', '~> 2.8') gem.add_dependency('excon') gem.add_dependency('faraday') From 6e9b07f305ea2464147b2ac161f00ae64298e05f Mon Sep 17 00:00:00 2001 From: Jennifer Vendetti Date: Tue, 1 Apr 2025 17:14:24 -0700 Subject: [PATCH 5/5] Bump version from 2.5.2 to 2.5.3 --- Gemfile.lock | 2 +- lib/ontologies_api_client/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index de44ca3..4a01ba6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ontologies_api_client (2.5.2) + ontologies_api_client (2.5.3) activesupport (= 7.2.2.1) addressable (~> 2.8) excon diff --git a/lib/ontologies_api_client/version.rb b/lib/ontologies_api_client/version.rb index 2715feb..c1f37f1 100644 --- a/lib/ontologies_api_client/version.rb +++ b/lib/ontologies_api_client/version.rb @@ -2,6 +2,6 @@ module LinkedData module Client - VERSION = '2.5.2' + VERSION = '2.5.3' end end