Class: Helium::Client
- Inherits:
-
Object
- Object
- Helium::Client
- Includes:
- Http, Organizations, Sensors, Users, Utils
- Defined in:
- lib/helium/client.rb,
lib/helium/client/http.rb,
lib/helium/client/users.rb,
lib/helium/client/sensors.rb,
lib/helium/client/organizations.rb
Defined Under Namespace
Modules: Http, Organizations, Sensors, Users
Constant Summary collapse
- API_VERSION =
1- HOST =
'api.helium.com'- PROTOCOL =
'https'- BASE_HTTP_HEADERS =
{ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => 'helium-ruby' }
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #debug? ⇒ Boolean
- #http_headers ⇒ Object
-
#initialize(api_key:, debug: false) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
Methods included from Sensors
#sensor, #sensor_timeseries, #sensor_timeseries_by_link, #sensors
Methods included from Organizations
#organization, #organization_users
Methods included from Users
Methods included from Http
Methods included from Utils
Constructor Details
#initialize(api_key:, debug: false) ⇒ Client
Returns a new instance of Client.
26 27 28 29 |
# File 'lib/helium/client.rb', line 26 def initialize(api_key:, debug: false) @api_key = api_key @debug = debug end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
24 25 26 |
# File 'lib/helium/client.rb', line 24 def api_key @api_key end |
Instance Method Details
#debug? ⇒ Boolean
35 36 37 |
# File 'lib/helium/client.rb', line 35 def debug? @debug == true end |
#http_headers ⇒ Object
39 40 41 42 43 |
# File 'lib/helium/client.rb', line 39 def http_headers BASE_HTTP_HEADERS.merge({ 'Authorization' => api_key }) end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/helium/client.rb', line 31 def inspect "<Helium::Client @debug=#{@debug}>" end |