Module: Helium::Client::Http
- Included in:
- Helium::Client
- Defined in:
- lib/helium/client/http.rb
Constant Summary
- API_VERSION =
1
- HOST =
'api.helium.com'
- PROTOCOL =
'https'
- BASE_HTTP_HEADERS =
{ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => 'helium-ruby' }
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path = nil, url: nil, params: {}) ⇒ Object
- #paginated_get(path, klass:, params: {}) ⇒ Object
- #patch(path, body: {}) ⇒ Object
- #post(path, body: {}) ⇒ Object
Instance Method Details
#delete(path) ⇒ Object
33 34 35 36 37 |
# File 'lib/helium/client/http.rb', line 33 def delete(path) request = generate_request(path, method: :delete) response = run(request) response.code == 204 end |
#get(path = nil, url: nil, params: {}) ⇒ Object
14 15 16 17 |
# File 'lib/helium/client/http.rb', line 14 def get(path = nil, url: nil, params: {}) request = generate_request(path, url: url, method: :get, params: params) run(request) end |
#paginated_get(path, klass:, params: {}) ⇒ Object
19 20 21 |
# File 'lib/helium/client/http.rb', line 19 def paginated_get(path, klass:, params: {}) Cursor.new(client: self, path: path, klass: klass, params: params) end |
#patch(path, body: {}) ⇒ Object
28 29 30 31 |
# File 'lib/helium/client/http.rb', line 28 def patch(path, body: {}) request = generate_request(path, method: :patch, body: body) run(request) end |
#post(path, body: {}) ⇒ Object
23 24 25 26 |
# File 'lib/helium/client/http.rb', line 23 def post(path, body: {}) request = generate_request(path, method: :post, body: body) run(request) end |