Module: Qa::Authorities::WebServiceBase

Included in:
AssignFast::GenericAuthority, Geonames, Getty::AAT, Getty::TGN, Getty::Ulan, Loc::GenericAuthority, Oclcts::GenericOclcAuthority
Defined in:
lib/qa/authorities/web_service_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#raw_responseObject

Returns the value of attribute raw_response.



5
6
7
# File 'lib/qa/authorities/web_service_base.rb', line 5

def raw_response
  @raw_response
end

Instance Method Details

#get_json(url) ⇒ Object

mix-in to retreive and parse JSON content from the web



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

def get_json(url)
  r = response(url).body
  JSON.parse(r)
end

#response(url) ⇒ Object



13
14
15
16
17
# File 'lib/qa/authorities/web_service_base.rb', line 13

def response(url)
  Faraday.get(url) do |req|
    req.headers['Accept'] = 'application/json'
  end
end