lib/alma/request.rb in alma-0.4.2 vs lib/alma/request.rb in alma-0.5.0
- old
+ new
@@ -9,11 +9,11 @@
REQUEST_TYPES = %w[HOLD DIGITIZATION BOOKING]
def self.submit(args)
request = new(args)
- response = HTTParty.post(
+ response = Net.post(
"#{bibs_base_path}/#{request.mms_id}/requests",
query: { user_id: request.user_id },
headers:,
body: request.body.to_json
)
@@ -138,11 +138,11 @@
end
class ItemRequest < BibRequest
def self.submit(args)
request = new(args)
- response = HTTParty.post(
+ response = Net.post(
"#{bibs_base_path}/#{request.mms_id}/holdings/#{request.holding_id}/items/#{request.item_pid}/requests",
query: { user_id: request.user_id },
headers:,
body: request.body.to_json
)
@@ -155,9 +155,11 @@
@holding_id = args.delete(:holding_id) { raise ArgumentError.new(":holding_id option must be specified to create request") }
@item_pid = args.delete(:item_pid) { raise ArgumentError.new(":item_pid option must be specified to create request") }
end
def additional_validation!(args)
+ return unless args.fetch(:request_type) == "DIGITIZATION"
+
args.fetch(:description) do
raise ArgumentError.new(
":description option must be specified when request_type is DIGITIZATION"
)
end