Class: BerkeleyLibrary::Location::HathiTrust::RecordUrlBatchRequest

Inherits:
Object
  • Object
show all
Includes:
RecordUrlRequestBase
Defined in:
lib/berkeley_library/location/hathi_trust/record_url_batch_request.rb

Constant Summary collapse

MAX_BATCH_SIZE =

Per HathiTrust API docs: www.hathitrust.org/bib_api

20

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oclc_numbers) ⇒ RecordUrlBatchRequest

Returns a new instance of RecordUrlBatchRequest.



14
15
16
# File 'lib/berkeley_library/location/hathi_trust/record_url_batch_request.rb', line 14

def initialize(oclc_numbers)
  @oclc_numbers = ensure_valid_oclc_numbers!(oclc_numbers)
end

Instance Attribute Details

#oclc_numbersObject (readonly)

Returns the value of attribute oclc_numbers.



12
13
14
# File 'lib/berkeley_library/location/hathi_trust/record_url_batch_request.rb', line 12

def oclc_numbers
  @oclc_numbers
end

Instance Method Details

#executeObject



18
19
20
21
# File 'lib/berkeley_library/location/hathi_trust/record_url_batch_request.rb', line 18

def execute
  response_body = URIs.get(uri, log: false)
  record_urls_from(response_body)
end

#uriObject



23
24
25
# File 'lib/berkeley_library/location/hathi_trust/record_url_batch_request.rb', line 23

def uri
  @uri ||= URIs.append(volumes_base_uri, 'json', URIs.path_escape(oclc_list))
end