Class: BerkeleyLibrary::Holdings::HathiTrust::RecordUrlRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oclc_number) ⇒ RecordUrlRequest

Returns a new instance of RecordUrlRequest.



11
12
13
# File 'lib/berkeley_library/holdings/hathi_trust/record_url_request.rb', line 11

def initialize(oclc_number)
  @oclc_number = OCLCNumber.ensure_oclc_number!(oclc_number)
end

Instance Attribute Details

#oclc_numberObject (readonly)

Returns the value of attribute oclc_number.



9
10
11
# File 'lib/berkeley_library/holdings/hathi_trust/record_url_request.rb', line 9

def oclc_number
  @oclc_number
end

Instance Method Details

#executeObject



15
16
17
18
# File 'lib/berkeley_library/holdings/hathi_trust/record_url_request.rb', line 15

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

#uriObject



20
21
22
# File 'lib/berkeley_library/holdings/hathi_trust/record_url_request.rb', line 20

def uri
  @uri ||= URIs.append(volumes_base_uri, 'oclc', URIs.path_escape("#{oclc_number}.json"))
end