Class: BerkeleyLibrary::Holdings::WorldCat::LibrariesRequest
- Inherits:
-
Object
- Object
- BerkeleyLibrary::Holdings::WorldCat::LibrariesRequest
- Includes:
- Util
- Defined in:
- lib/berkeley_library/holdings/world_cat/libraries_request.rb
Overview
Constant Summary collapse
- XPATH_INST_ID_VALS =
'/holdings/holding/institutionIdentifier/value'.freeze
Instance Attribute Summary collapse
-
#oclc_number ⇒ Object
readonly
Returns the value of attribute oclc_number.
-
#symbols ⇒ Object
readonly
Returns the value of attribute symbols.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(oclc_number, symbols: Symbols::ALL) ⇒ LibrariesRequest
constructor
A new instance of LibrariesRequest.
-
#params ⇒ Object
TODO: Check that this works w/more than 10 results See developer.api.oclc.org/wcv1#/Holdings.
- #uri ⇒ Object
Constructor Details
#initialize(oclc_number, symbols: Symbols::ALL) ⇒ LibrariesRequest
Returns a new instance of LibrariesRequest.
17 18 19 20 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 17 def initialize(oclc_number, symbols: Symbols::ALL) @oclc_number = OCLCNumber.ensure_oclc_number!(oclc_number) @symbols = Symbols.ensure_valid!(symbols) end |
Instance Attribute Details
#oclc_number ⇒ Object (readonly)
Returns the value of attribute oclc_number.
15 16 17 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 15 def oclc_number @oclc_number end |
#symbols ⇒ Object (readonly)
Returns the value of attribute symbols.
15 16 17 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 15 def symbols @symbols end |
Instance Method Details
#execute ⇒ Object
37 38 39 40 41 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 37 def execute response_body = URIs.get(uri, params:, log: false) holdings_syms = holdings_from(response_body) holdings_syms.select { |sym| symbols.include?(sym) } # just in case end |
#params ⇒ Object
TODO: Check that this works w/more than 10 results
See https://developer.api.oclc.org/wcv1#/Holdings
28 29 30 31 32 33 34 35 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 28 def params @params ||= { 'oclcsymbol' => symbols.join(','), 'servicelevel' => 'full', 'frbrGrouping' => 'off', 'wskey' => Config.api_key } end |
#uri ⇒ Object
22 23 24 |
# File 'lib/berkeley_library/holdings/world_cat/libraries_request.rb', line 22 def uri @uri ||= URIs.append(holdings_base_uri, URIs.path_escape(oclc_number)) end |