helium-ruby 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e2bd4e4cfd042caf268983bcdea5f5a2d6c7220
4
- data.tar.gz: 84dad25272cb7e0d317c8e8502c5aa65c547dccd
3
+ metadata.gz: a4af50ffa5000019d32db28c533de9ebbb233d4c
4
+ data.tar.gz: b9c5e076c582125fba4485173f1198cba999b35b
5
5
  SHA512:
6
- metadata.gz: ce3a6ef340b593cf20dd349f66482ae5a561710f04b4a476372b1d09e02c7dce50fa3e8c621b1580a5293ee47649dcacaa07a2dda0d2a68d0b8aee2155f0c12b
7
- data.tar.gz: b135d1fafa384cca00ef1bac751471d0a3c3fce0ad60a5d079be3379d3d5e811839f63c22f0c7ffeff5d62a3ea0e40c047e4c85a69479ca6f2b6fe45db36c44d
6
+ metadata.gz: d9be6bfe31b043fb7f5665e836c4f73a23edfedff310c50237d7886583dffc956b16d756869789e2006ea68382f30f09f07b85cd9fdab34f7c9744508fe2cffa
7
+ data.tar.gz: 2a53a745a22ebcce1c0838ba847e51e318ee70ffecd037c685b7214bbe41221066e65a3f658283c069d324b48babef4d70f58989d63c06f773b59a6e79a5416a
@@ -10,9 +10,9 @@ module Helium
10
10
  end
11
11
 
12
12
  def element_sensors(element)
13
- path = "/element/#{element.id}?include=sensor"
13
+ path = "/element/#{element.id}/sensor"
14
14
  response = get(path)
15
- sensors_data = JSON.parse(response.body)["included"]
15
+ sensors_data = JSON.parse(response.body)["data"]
16
16
 
17
17
  sensors = sensors_data.map do |sensor|
18
18
  Sensor.new(client: self, params: sensor)
@@ -17,6 +17,39 @@ module Helium
17
17
 
18
18
  return users
19
19
  end
20
+
21
+ def organization_labels
22
+ response = get('/organization/label')
23
+ labels_data = JSON.parse(response.body)["data"]
24
+
25
+ labels = labels_data.map do |label_data|
26
+ Label.new(client: self, params: label_data)
27
+ end
28
+
29
+ return labels
30
+ end
31
+
32
+ def organization_elements
33
+ response = get('/organization/element')
34
+ elements_data = JSON.parse(response.body)["data"]
35
+
36
+ elements = elements_data.map do |element_data|
37
+ Element.new(client: self, params: element_data)
38
+ end
39
+
40
+ return elements
41
+ end
42
+
43
+ def organization_sensors
44
+ response = get('/organization/sensor')
45
+ sensors_data = JSON.parse(response.body)["data"]
46
+
47
+ sensors = sensors_data.map do |sensor_data|
48
+ Sensor.new(client: self, params: sensor_data)
49
+ end
50
+
51
+ return sensors
52
+ end
20
53
  end
21
54
  end
22
55
  end
@@ -9,6 +9,15 @@ module Helium
9
9
  Sensor.find(id, client: self)
10
10
  end
11
11
 
12
+ def sensor_element(sensor)
13
+ path = "/sensor/#{sensor.id}/element"
14
+ response = get(path)
15
+ elementj = JSON.parse(response.body)["data"]
16
+ element = Element.new(client: self, params: elementj)
17
+
18
+ return element
19
+ end
20
+
12
21
  def sensor_timeseries(sensor, opts = {})
13
22
  path = "/sensor/#{sensor.id}/timeseries"
14
23
 
@@ -14,6 +14,18 @@ module Helium
14
14
  @client.organization_users
15
15
  end
16
16
 
17
+ def labels
18
+ @client.organization_labels
19
+ end
20
+
21
+ def elements
22
+ @client.organization_elements
23
+ end
24
+
25
+ def sensors
26
+ @client.organization_sensors
27
+ end
28
+
17
29
  def as_json
18
30
  super.merge({
19
31
  name: name,
data/lib/helium/sensor.rb CHANGED
@@ -11,6 +11,10 @@ module Helium
11
11
  @last_seen = @params.dig('meta', 'last-seen')
12
12
  end
13
13
 
14
+ def element
15
+ @client.sensor_element(self)
16
+ end
17
+
14
18
  def self.all_path
15
19
  "/sensor?include=label"
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Helium
2
- VERSION = "0.12.0"
2
+ VERSION = "0.13.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helium-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Allen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-10-12 00:00:00.000000000 Z
12
+ date: 2016-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus