Class: Qa::Authorities::Lcsh
Instance Attribute Summary
Attributes inherited from Base
#query_url, #raw_response, #response
Instance Method Summary collapse
-
#initialize(q, sub_authority = '') ⇒ Lcsh
constructor
Initialze the Lcsh class with a query and get the http response from LOC’s server.
-
#parse_authority_response ⇒ Object
Format response to the correct JSON structure.
- #query ⇒ Object
- #suggestions ⇒ Object
- #urls_for_suggestions ⇒ Object
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, ='') self.query_url= "http://id.loc.gov/authorities/suggest/?q=" + q super end |
Instance Method Details
#parse_authority_response ⇒ Object
Format response to the correct JSON structure
15 16 17 |
# File 'lib/qa/authorities/lcsh.rb', line 15 def self.response = build_response end |
#query ⇒ Object
19 20 21 |
# File 'lib/qa/authorities/lcsh.rb', line 19 def query self.raw_response[0] end |
#suggestions ⇒ Object
23 24 25 |
# File 'lib/qa/authorities/lcsh.rb', line 23 def suggestions self.raw_response[1] end |
#urls_for_suggestions ⇒ Object
27 28 29 |
# File 'lib/qa/authorities/lcsh.rb', line 27 def urls_for_suggestions self.raw_response[3] end |