Class: Alma::ItemRequest
- Inherits:
-
BibRequest
- Object
- BibRequest
- Alma::ItemRequest
- Defined in:
- lib/alma/request.rb
Constant Summary
Constants inherited from BibRequest
Instance Attribute Summary collapse
-
#holding_id ⇒ Object
readonly
Returns the value of attribute holding_id.
-
#item_pid ⇒ Object
readonly
Returns the value of attribute item_pid.
Attributes inherited from BibRequest
#body, #mms_id, #request_type, #user_id
Class Method Summary collapse
Instance Method Summary collapse
- #additional_validation!(args) ⇒ Object
-
#initialize(args) ⇒ ItemRequest
constructor
A new instance of ItemRequest.
Methods inherited from BibRequest
#additional_normalization!, #booking_normalization, #booking_validation, #digitization_normalization, #digitization_validation, #hold_normalization, #hold_validation, #normalize!, #request_type_normalization!, #request_type_validation!, #validate!
Methods included from ApiDefaults
#apikey, #bibs_base_path, #configuration_base_path, #headers, #items_base_path, #region, #timeout, #users_base_path
Constructor Details
#initialize(args) ⇒ ItemRequest
Returns a new instance of ItemRequest.
153 154 155 156 157 |
# File 'lib/alma/request.rb', line 153 def initialize(args) super(args) @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 |
Instance Attribute Details
#holding_id ⇒ Object (readonly)
Returns the value of attribute holding_id.
152 153 154 |
# File 'lib/alma/request.rb', line 152 def holding_id @holding_id end |
#item_pid ⇒ Object (readonly)
Returns the value of attribute item_pid.
152 153 154 |
# File 'lib/alma/request.rb', line 152 def item_pid @item_pid end |
Class Method Details
.submit(args) ⇒ Object
141 142 143 144 145 146 147 148 149 150 |
# File 'lib/alma/request.rb', line 141 def self.submit(args) request = new(args) 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 ) Alma::Response.new(response) end |
Instance Method Details
#additional_validation!(args) ⇒ Object
159 160 161 162 163 164 165 166 167 |
# File 'lib/alma/request.rb', line 159 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 end |