Class: Alma::RequestOptions
- Inherits:
-
Object
- Object
- Alma::RequestOptions
- Extended by:
- Forwardable
- Defined in:
- lib/alma/request_options.rb
Constant Summary collapse
- REQUEST_OPTIONS_PERMITTED_ARGS =
[:user_id]
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
Returns the value of attribute raw_response.
-
#request_options ⇒ Object
Returns the value of attribute request_options.
Class Method Summary collapse
Instance Method Summary collapse
- #digitization_allowed? ⇒ Boolean
- #hold_allowed? ⇒ Boolean
-
#initialize(response) ⇒ RequestOptions
constructor
A new instance of RequestOptions.
Constructor Details
#initialize(response) ⇒ RequestOptions
Returns a new instance of RequestOptions.
10 11 12 13 |
# File 'lib/alma/request_options.rb', line 10 def initialize(response) @raw_response = response @request_options = JSON.parse(response.body)["request_option"] end |
Instance Attribute Details
#raw_response ⇒ Object
Returns the value of attribute raw_response.
5 6 7 |
# File 'lib/alma/request_options.rb', line 5 def raw_response @raw_response end |
#request_options ⇒ Object
Returns the value of attribute request_options.
5 6 7 |
# File 'lib/alma/request_options.rb', line 5 def @request_options end |
Class Method Details
.get(mms_id, options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/alma/request_options.rb', line 15 def self.get(mms_id, ={}) url = "#{bibs_base_path}/#{mms_id}/request-options" .select! {|k,_| REQUEST_OPTIONS_PERMITTED_ARGS.include? k } response = HTTParty.get(url, headers: headers, query: ) new(response) end |
Instance Method Details
#digitization_allowed? ⇒ Boolean
26 27 28 |
# File 'lib/alma/request_options.rb', line 26 def digitization_allowed? !.select {|option| option["type"]["value"] == "DIGITIZATION" }.empty? end |
#hold_allowed? ⇒ Boolean
22 23 24 |
# File 'lib/alma/request_options.rb', line 22 def hold_allowed? !.select {|option| option["type"]["value"] == "HOLD" }.empty? end |