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

Instance Method Details

#delete(path) ⇒ Object



33
34
35
36
# File 'lib/helium/client/http.rb', line 33

def delete(path)
  response = run(path, :delete)
  response.code == 204
end

#get(path, opts = {}) ⇒ Object



14
15
16
# File 'lib/helium/client/http.rb', line 14

def get(path, opts = {})
  run(path, :get, opts)
end

#paginated_get(path, opts = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/helium/client/http.rb', line 18

def paginated_get(path, opts = {})
  klass  = opts.fetch(:klass)
  params = opts.fetch(:params, {})

  Cursor.new(client: self, path: path, klass: klass, params: params)
end

#patch(path, opts = {}) ⇒ Object



29
30
31
# File 'lib/helium/client/http.rb', line 29

def patch(path, opts = {})
  run(path, :patch, opts)
end

#post(path, opts = {}) ⇒ Object



25
26
27
# File 'lib/helium/client/http.rb', line 25

def post(path, opts = {})
  run(path, :post, opts)
end