Class: Qa::Authorities::Lcsh

Inherits:
Base
  • Object
show all
Defined in:
lib/qa/authorities/lcsh.rb

Instance Attribute Summary

Attributes inherited from Base

#query_url, #raw_response, #response

Instance Method Summary collapse

Methods inherited from Base

authority_valid?, #get_full_record, #results, sub_authorities

Constructor Details

#initialize(q, sub_authority = '') ⇒ Lcsh

Initialze the Lcsh class with a query and get the http response from LOC’s server. This is set to a JSON object



8
9
10
11
12
# File 'lib/qa/authorities/lcsh.rb', line 8

def initialize(q, sub_authority='')
  self.query_url= "http://id.loc.gov/authorities/suggest/?q=" + q

  super
end

Instance Method Details

#parse_authority_responseObject

Format response to the correct JSON structure



15
16
17
# File 'lib/qa/authorities/lcsh.rb', line 15

def parse_authority_response
  self.response = build_response
end

#queryObject



19
20
21
# File 'lib/qa/authorities/lcsh.rb', line 19

def query
  self.raw_response[0]
end

#suggestionsObject



23
24
25
# File 'lib/qa/authorities/lcsh.rb', line 23

def suggestions
  self.raw_response[1]
end

#urls_for_suggestionsObject



27
28
29
# File 'lib/qa/authorities/lcsh.rb', line 27

def urls_for_suggestions
  self.raw_response[3]
end