Skip to content

Commit

Permalink
DACCESS-261: Rely on new version of cul-folio-edge (#109) (#110)
Browse files Browse the repository at this point in the history
* FOLIO token changes, authenticate returns a token expiration

* Require latest version of cul_folio_edge; remove borrow_direct dependency (DACCESS-261)

* Formatting

* Remove 'newcatalog' references

* Remove 'newcatalog' references

---------

Co-authored-by: Melissa Wallace <[email protected]>
Co-authored-by: Sarah Chintomby <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent cf1a586 commit 0cea3d4
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ gemspec
gem 'rails', '~>6.1'
gem 'unf_ext'

#gem 'cul-folio-edge', :path => '/Users/matt/code/cul/d&a/cul-folio-edge'
gem 'cul-folio-edge', :git => 'https://github.com/cul-it/cul-folio-edge'
# gem 'cul-folio-edge', :path => '/Users/matt/code/cul/d&a/cul-folio-edge'
gem 'cul-folio-edge', git: 'https://github.com/cul-it/cul-folio-edge'
7 changes: 4 additions & 3 deletions app/controllers/my_account/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ def index
end

# Return a FOLIO authentication token for API calls -- either from the session if a token
# was prevoiusly created, or directly from FOLIO otherwise.
# was previously created, or has expired, or directly from FOLIO otherwise.
def folio_token
if session[:folio_token].nil?
if session[:folio_token].nil? || (session[:folio_token_exp].present? && Time.now > Time.parse(session[:folio_token_exp]))
url = ENV['OKAPI_URL']
tenant = ENV['OKAPI_TENANT']
response = CUL::FOLIO::Edge.authenticate(url, tenant, ENV['OKAPI_USER'], ENV['OKAPI_PW'])
if response[:code] >= 300
Rails.logger.error "MyAccount error: Could not create a FOLIO token for #{user}"
else
session[:folio_token] = response[:token]
session[:folio_token_exp] = response[:token_exp]
end
end
session[:folio_token]
Expand Down Expand Up @@ -277,7 +278,7 @@ def ajax_catalog_link_and_source
# FOLIO. A FOLIO source indicates that this was a locally-created record -- e.g., for a temporary record
# for a BD/ReShare item. Most of the others appear to be MARC-source. This is probably not entirely accurate,
# but we can filter out the FOLIO records and probably get things right most of the time.
link = "https://newcatalog.library.cornell.edu/catalog/#{response[:instance]['hrid']}" if source == 'MARC'
link = "https://catalog.library.cornell.edu/catalog/#{response[:instance]['hrid']}" if source == 'MARC'
end
render json: { link: link, source: source }
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/my_account/my_account_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def cased_title_link item
# but indicates an actual library location for Voyager records.
# item['lo'] == '' || item['TransactionNumber'] ?
# display_title :
# link_to(display_title, "https://newcatalog.library.cornell.edu/catalog/#{item['bid']}")
# link_to(display_title, "https://catalog.library.cornell.edu/catalog/#{item['bid']}")
end

# Return a user-readable item status message. This will filter out the 'pahr' statuses that turn
Expand Down
2 changes: 1 addition & 1 deletion app/views/my_account/account/_fines.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
%td
= number_to_currency(f['chargeAmount']['amount'])
%p
= link_to "View fine rates", "https://newcatalog.library.cornell.edu/myaccount/login"
= link_to "View fine rates", "https://catalog.library.cornell.edu/myaccount/login"
2 changes: 1 addition & 1 deletion lib/my_account/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MyAccount
VERSION = "2.2.5"
VERSION = '2.3'
end
15 changes: 7 additions & 8 deletions my_account.gemspec
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
$:.push File.expand_path("../lib", __FILE__)

# Maintain your gem's version:
require "my_account/version"
require 'my_account/version'

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "my_account"
s.version = MyAccount::VERSION
s.authors = ["Matt Connolly"]
s.email = ["[email protected]"]
s.homepage = "http://newcatalog.library.cornell.edu/myaccount"
s.summary = "Summary of MyAccount."
s.description = "Description of MyAccount."
s.homepage = "http://catalog.library.cornell.edu/myaccount"
s.summary = "User account page for Cornell University Library online catalog"
s.description = "Provides a user account page for the Cornell University Library online catalog, including user account information, loans, requests, and fines."
s.license = "MIT"

s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]

s.add_dependency "rails", "~> 6.1"
s.add_dependency 'rails', '~> 6.1'
s.add_dependency 'blacklight',['>= 7.0']
s.add_dependency "xml-simple"
s.add_dependency 'xml-simple'
s.add_dependency 'rest-client'
s.add_dependency 'borrow_direct'
s.add_dependency 'cul-folio-edge', ['>= 1.2.1']
s.add_dependency 'cul-folio-edge', '~3.1'

s.add_development_dependency "sqlite3"
end
8 changes: 8 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes - my-account

## [2.3] - 2024-08-12

### Changed
- Require v3.1 of `cul-folio-edge` to use new authentication tokens (DACCESS-261)
- Update catalog links to remove obsolete `newcatalog` qualifier

### Removed
- Obsolete dependency on `borrow_direct`

## v2.2.5
- Change spelling of "Borrow Direct" to "BorrowDirect"
Expand Down

0 comments on commit 0cea3d4

Please sign in to comment.