Module: PanlexClient
- Defined in:
- lib/panlex_client/panlex_client.rb
Overview
panlex_client namespace
Constant Summary collapse
- API_URL =
PanLex public API URL
'http://api.panlex.org/'
Class Method Summary collapse
-
.query(param, body) ⇒ Hash
Send a request to PanLex API and return JSON.
Class Method Details
.query(param, body) ⇒ Hash
Send a request to PanLex API and return JSON.
12 13 14 15 16 17 18 19 |
# File 'lib/panlex_client/panlex_client.rb', line 12 def self.query(param, body) begin response = RestClient.post API_URL+param, body.to_json, { 'content-type' => :json, :accept => :json, 'accept-encoding' => 'gzip' } JSON.parse(response) rescue RestClient::ExceptionWithResponse => e raise e end end |