Skip to content

Commit

Permalink
Merge remote branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroquem committed Nov 13, 2015
2 parents 3dad109 + 75dca8a commit 9b4d04d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
6 changes: 0 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ gem "thor"
#gem 'blacklight', '5.9'
gem 'rails', '~>4.0'

# NOTE: BD should really be specified in the gemspec, but we need a specific
# git repo branch for now, so we have to make the call here. Once we're back
# on master, we should be able to remove this call and uncomment the one in
# the gemspec file
gem 'borrow_direct', :git => 'git@github.com:jrochkind/borrow_direct.git'

gemspec

# jquery-rails is used by the dummy application
Expand Down
22 changes: 17 additions & 5 deletions app/models/blacklight_cornell_requests/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -985,21 +985,23 @@ def make_voyager_request params
def available_in_bd? netid, params

# Set up params for BorrowDirect gem
if Rails.env.production?
# if this isn't specified, defaults to BD test database
#BorrowDirect::Defaults.api_base = BorrowDirect::Defaults::PRODUCTION_API_BASE
end
BorrowDirect::Defaults.api_key = ENV['BORROW_DIRECT_TEST_API_KEY']
BorrowDirect::Defaults.library_symbol = 'CORNELL'
BorrowDirect::Defaults.api_key = ENV['BORROW_DIRECT_API_KEY']
BorrowDirect::Defaults.find_item_patron_barcode = patron_barcode(netid)
BorrowDirect::Defaults.timeout = 30 # (seconds)
# if api_base isn't specified, it defaults to BD test database
if Rails.env.production?
BorrowDirect::Defaults.api_base = BorrowDirect::Defaults::PRODUCTION_API_BASE
BorrowDirect::Defaults.api_key = ENV['BORROW_DIRECT_PROD_API_KEY']
end

response = nil
# This block can throw timeout errors if BD takes to long to respond
begin
if !params[:isbn].nil?
# Note: [*<variable>] gives us an array if we don't already have one,
# which we need for the map.

response = BorrowDirect::FindItem.new.find(:isbn => ([*params[:isbn]].map!{|i| i.clean_isbn}))
elsif !params[:title].nil?
response = BorrowDirect::FindItem.new.find(:phrase => params[:title])
Expand All @@ -1009,16 +1011,25 @@ def available_in_bd? netid, params
return response.requestable?

rescue Errno::ECONNREFUSED => e
if ENV['ROUTE_EXCEPTIONS_TO_HIPCHAT'] == 'true'
ExceptionNotifier.notify_exception(e)
end
Rails.logger.warn 'Requests: Borrow Direct connection was refused'
Rails.logger.warn e.message
Rails.logger.warn e.backtrace.inspect
return false
rescue BorrowDirect::HttpTimeoutError => e
if ENV['ROUTE_EXCEPTIONS_TO_HIPCHAT'] == 'true'
ExceptionNotifier.notify_exception(e)
end
Rails.logger.warn 'Requests: Borrow Direct check timed out'
Rails.logger.warn e.message
Rails.logger.warn e.backtrace.inspect
return false
rescue BorrowDirect::Error => e
if ENV['ROUTE_EXCEPTIONS_TO_HIPCHAT'] == 'true'
ExceptionNotifier.notify_exception(e)
end
Rails.logger.warn 'Requests: Borrow Direct gave error.'
Rails.logger.warn e.message
Rails.logger.warn e.backtrace.inspect
Expand Down Expand Up @@ -1053,3 +1064,4 @@ def clean_isbn
end
end


1 change: 1 addition & 0 deletions blacklight_cornell_requests.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Gem::Specification.new do |s|
s.add_dependency 'dotenv-rails'
s.add_dependency 'dotenv-deployment'
s.add_dependency 'borrow_direct'
s.add_dependency 'exception_notification'

s.add_development_dependency "sqlite3"

Expand Down
4 changes: 4 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Next release (version TBD)

### Enhancements
- Borrow Direct settings have been updated to work with the new BD production database (DISCOVERYACCESS-2006)
- Added an option to route exception notifications (mostly for Borrow Direct) to HipChat

### Bug fixes
- Fixed the broken purchase request submit button (DISCOVERYACCESS-1790)
- Fixed a bug where request comments were not carried through to Voyager (DISCOVERYACCESS-2084)
Expand Down

0 comments on commit 9b4d04d

Please sign in to comment.