Skip to content

Commit

Permalink
Merge pull request #82 from pulibrary/i81-jrgriffiniii-thesis-json-fails
Browse files Browse the repository at this point in the history
Upgrading to support Ruby 3.2 releases
  • Loading branch information
jrgriffiniii committed Apr 30, 2024
2 parents 3c288ca + 3eae008 commit c88a417
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
working_directory: ~/orangetheses

docker:
- image: cimg/ruby:3.1-browsers
- image: cimg/ruby:3.2-browsers
environment:
RAILS_ENV: test

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
working_directory: ~/orangetheses

docker:
- image: cimg/ruby:3.1-browsers
- image: cimg/ruby:3.2-browsers
environment:
RAILS_ENV: test

Expand Down
2 changes: 1 addition & 1 deletion lib/orangetheses/dataspace_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def embargo_terms_field
end

def embargo_date_fields
@embargo_date_fields ||= (embargo_lift_field || embargo_terms_field)
@embargo_date_fields ||= embargo_lift_field || embargo_terms_field
end

def embargo_date_field
Expand Down
12 changes: 11 additions & 1 deletion lib/orangetheses/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'openssl'
require 'retriable'
require 'logger'
require 'pry'

# Do not fail if SSL negotiation with DSpace isn't working
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
Expand Down Expand Up @@ -218,15 +219,24 @@ def api_communities
@api_communities ||= begin
response = api_client.get("#{@server}/communities/")
response.body
rescue StandardError => e
Faraday.logger.warn(e)
'[]'
end
end

def json_api_communities
@json_api_communities ||= JSON.parse(api_communities)
end

##
# Parse the JSON feed containing all of the communities, and return only the
# community that matches the handle.
# @return [JSON] a json representation of the DSpace community
def api_community
@api_community ||= JSON.parse(api_communities).find { |c| c['handle'] == @community }
return if json_api_communities.empty?

@api_community ||= json_api_communities.find { |c| c['handle'] == @community }
end

##
Expand Down
1 change: 1 addition & 0 deletions lib/orangetheses/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require 'iso-639'
require 'yaml'
require 'erb'
require 'ostruct'

module Orangetheses
class Indexer
Expand Down
2 changes: 1 addition & 1 deletion lib/orangetheses/visual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def initialize(solr_server = nil)
solr_server ||= self.class.default_solr_url

@tmpdir = Dir.mktmpdir
@solr = RSolr.connect(url: solr_server, read_timeout: 120, open_timeout: 120)
@solr = RSolr.connect(url: solr_server, timeout: 120, open_timeout: 120)
@logger = Logger.new($stdout)
@logger.level = Logger::INFO
@logger.formatter = proc do |severity, datetime, _progname, msg|
Expand Down

0 comments on commit c88a417

Please sign in to comment.