Class: Zenaton::Services::Http
- Inherits:
-
Object
- Object
- Zenaton::Services::Http
- Defined in:
- lib/zenaton/services/http.rb
Overview
Wrapper class around HTTParty that:
-
handles http calls
-
sets appropriate headers for each request type
-
translates exceptions into Zenaton specific ones
Instance Method Summary collapse
-
#get(url) ⇒ Hash
Makes a GET request and sets the correct headers.
-
#post(url, body) ⇒ Hash
Makes a POST request with some data and sets the correct headers.
-
#put(url, body) ⇒ Hash
Makes a PUT request with some data and sets the correct headers.
Instance Method Details
#get(url) ⇒ Hash
Makes a GET request and sets the correct headers
18 19 20 |
# File 'lib/zenaton/services/http.rb', line 18 def get(url) request(:get, url, ) end |
#post(url, body) ⇒ Hash
Makes a POST request with some data and sets the correct headers
27 28 29 |
# File 'lib/zenaton/services/http.rb', line 27 def post(url, body) request(:post, url, (body)) end |
#put(url, body) ⇒ Hash
Makes a PUT request with some data and sets the correct headers
36 37 38 |
# File 'lib/zenaton/services/http.rb', line 36 def put(url, body) request(:put, url, (body)) end |