Class: Helium::Client

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

Defined Under Namespace

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

Constant Summary collapse

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 Users

#user

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 Labels

#create_label, #label, #labels

Methods included from Http

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

Methods included from HeliumScripts

#create_library, #create_package, #create_script, #create_sensor_package, #libraries, #library, #package, #packages, #script, #scripts, #sensor_package, #sensor_packages

Methods included from Elements

#element, #element_device_configuration, #element_timeseries, #elements

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 Utils

#datetime_to_iso, #kebab_case

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



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

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.



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

def api_key
  @api_key
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/helium/client.rb', line 44

def debug?
  @debug == true
end

#inspectObject



40
41
42
# File 'lib/helium/client.rb', line 40

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