Method: AI21::HTTP#fetch
- Defined in:
- lib/ai21/http.rb
#fetch(path, method, body = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ai21/http.rb', line 24 def fetch(path, method, body = nil) url = url(path) http = http(url) request = request(url, method) request.body = body.to_json if body body = http.request(request).read_body camel_to_snake ::JSON.parse(body) end |