Class: Eli::RestApi
- Inherits:
-
Object
- Object
- Eli::RestApi
- Defined in:
- lib/eli/rest_api.rb
Overview
Documentation for Eli::RestApi.
Thin wrapper around Faraday that mirrors the behaviour of the Elixir Req
based client: it normalizes headers (always sending a JSON content type),
encodes request bodies as JSON and appends params to the query string for
the verbs that don't carry a body.
Defined Under Namespace
Classes: Response
Constant Summary collapse
- JSON_CONTENT_TYPE =
"application/json"
Class Method Summary collapse
-
.delete(url, options = {}) ⇒ Object
Delete.
-
.get(url, options = {}) ⇒ Object
Get.
-
.head(url, options = {}) ⇒ Object
Head.
-
.patch(url, options = {}) ⇒ Object
Patch.
-
.post(url, options = {}) ⇒ Object
Post.
-
.put(url, options = {}) ⇒ Object
Put.
Class Method Details
.delete(url, options = {}) ⇒ Object
71 72 73 |
# File 'lib/eli/rest_api.rb', line 71 def delete(url, = {}) request_with_query(:delete, url, ) end |
.get(url, options = {}) ⇒ Object
53 54 55 |
# File 'lib/eli/rest_api.rb', line 53 def get(url, = {}) request_with_query(:get, url, ) end |
.head(url, options = {}) ⇒ Object
62 63 64 |
# File 'lib/eli/rest_api.rb', line 62 def head(url, = {}) request_with_query(:head, url, ) end |
.patch(url, options = {}) ⇒ Object
44 45 46 |
# File 'lib/eli/rest_api.rb', line 44 def patch(url, = {}) request_with_body(:patch, url, ) end |
.post(url, options = {}) ⇒ Object
26 27 28 |
# File 'lib/eli/rest_api.rb', line 26 def post(url, = {}) request_with_body(:post, url, ) end |