Class: Qa::Authorities::Oclcts::GenericOclcAuthority

Inherits:
Base
  • Object
show all
Includes:
WebServiceBase
Defined in:
lib/qa/authorities/oclcts/generic_oclc_authority.rb

Instance Attribute Summary collapse

Attributes included from WebServiceBase

#raw_response

Instance Method Summary collapse

Methods included from WebServiceBase

#json, #response

Methods inherited from Base

#all

Constructor Details

#initialize(subauthority) ⇒ GenericOclcAuthority

Returns a new instance of GenericOclcAuthority.



5
6
7
8
# File 'lib/qa/authorities/oclcts/generic_oclc_authority.rb', line 5

def initialize(subauthority)
  super()
  @subauthority = subauthority
end

Instance Attribute Details

#subauthorityObject (readonly)

Returns the value of attribute subauthority.



3
4
5
# File 'lib/qa/authorities/oclcts/generic_oclc_authority.rb', line 3

def subauthority
  @subauthority
end

Instance Method Details

#find(id) ⇒ Object



20
21
22
23
# File 'lib/qa/authorities/oclcts/generic_oclc_authority.rb', line 20

def find(id)
  get_raw_response("id-lookup", id)
  parse_full_record(id)
end

#search(q) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/qa/authorities/oclcts/generic_oclc_authority.rb', line 11

def search(q)
  get_raw_response("prefix-query", q)
  r = []
  raw_response.xpath('sru:searchRetrieveResponse/sru:records/sru:record/sru:recordData', 'sru' => 'http://www.loc.gov/zing/srw/').each do |record|
    r.append("id" => record.xpath('Zthes/term/termId').first.content, "label" => record.xpath('Zthes/term/termName').first.content)
  end
  r
end