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
-
#raw_response ⇒ Object
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#get_json(url) ⇒ Object
mix-in to retreive and parse JSON content from the web.
- #response(url) ⇒ Object
Instance Attribute Details
#raw_response ⇒ Object
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 |