Class: Helium::Client

Inherits:
Object
  • Object
show all
Includes:
Configurations, DeviceConfigurations, 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,
lib/helium/client/configurations.rb,
lib/helium/client/device_configurations.rb

Defined Under Namespace

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

Constant Summary

API_VERSION =
'v1'
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 DeviceConfigurations

#create_device_configuration, #device_configuration, #device_configuration_configuration, #device_configuration_device, #device_configurations

Methods included from Configurations

#configuration, #configurations, #create_configuration

Methods included from Elements

#element, #element_device_configuration, #element_timeseries, #elements

Methods included from Labels

#create_label, #label, #labels

Methods included from Sensors

#create_sensor, #sensor, #sensor_device_configuration, #sensor_element, #sensor_live_timeseries, #sensor_timeseries, #sensors

Methods included from Organizations

#organization

Methods included from Users

#user

Methods included from Http

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

Methods included from Utils

#datetime_to_iso, #kebab_case

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client



29
30
31
32
33
34
35
36
# File 'lib/helium/client.rb', line 29

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

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key



27
28
29
# File 'lib/helium/client.rb', line 27

def api_key
  @api_key
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/helium/client.rb', line 42

def debug?
  @debug == true
end

#inspectObject



38
39
40
# File 'lib/helium/client.rb', line 38

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