Class: Helium::Client

Inherits:
Object
  • Object
show all
Includes:
Elements, Http, Labels, Organizations, Sensors, Users, Utils
Defined in:
lib/helium/client.rb,
lib/helium/client/http.rb,
lib/helium/client/users.rb,
lib/helium/client/labels.rb,
lib/helium/client/sensors.rb,
lib/helium/client/elements.rb,
lib/helium/client/organizations.rb

Defined Under Namespace

Modules: Elements, Http, Labels, Organizations, Sensors, Users

Constant Summary

API_VERSION =
1
HOST =
'api.helium.com'
PROTOCOL =
'https'

Constants included from Http

Http::BASE_HTTP_HEADERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Elements

#element, #element_sensors, #elements

Methods included from Labels

#create_label, #label, #label_sensors, #labels, #update_label_sensors

Methods included from Sensors

#create_sensor, #sensor, #sensor_timeseries, #sensors

Methods included from Organizations

#organization, #organization_users

Methods included from Users

#user

Methods included from Http

#base_url, #delete, #get, #paginated_get, #patch, #post, #url_for

Methods included from Utils

#datetime_to_iso

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client



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

def initialize(opts = {})
  @api_key  = opts.fetch(:api_key)
  @api_host = opts.fetch(:host, HOST)
  @debug    = opts.fetch(:debug, false)
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key



22
23
24
# File 'lib/helium/client.rb', line 22

def api_key
  @api_key
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


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

def debug?
  @debug == true
end

#inspectObject



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

def inspect
  "<Helium::Client @debug=#{@debug}>"
end