helium-ruby 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/Helium.html +1 -1
- data/docs/Helium/Client.html +1 -1
- data/docs/Helium/Client/Elements.html +1 -1
- data/docs/Helium/Client/Http.html +1 -1
- data/docs/Helium/Client/Labels.html +1 -1
- data/docs/Helium/Client/Organizations.html +1 -1
- data/docs/Helium/Client/Sensors.html +1 -1
- data/docs/Helium/Client/Users.html +1 -1
- data/docs/Helium/ClientError.html +1 -1
- data/docs/Helium/Cursor.html +1 -1
- data/docs/Helium/DataPoint.html +1 -1
- data/docs/Helium/Element.html +1 -1
- data/docs/Helium/Error.html +1 -1
- data/docs/Helium/InvalidApiKey.html +1 -1
- data/docs/Helium/Label.html +1 -1
- data/docs/Helium/Organization.html +1 -1
- data/docs/Helium/Resource.html +1 -1
- data/docs/Helium/Sensor.html +1 -1
- data/docs/Helium/User.html +1 -1
- data/docs/Helium/Utils.html +1 -1
- data/docs/_index.html +1 -1
- data/docs/file.README.html +1 -1
- data/docs/index.html +1 -1
- data/docs/top-level-namespace.html +1 -1
- data/lib/helium/client.rb +4 -3
- data/lib/helium/client/http.rb +5 -4
- data/lib/helium/resource.rb +6 -2
- data/lib/helium/sensor.rb +15 -1
- data/lib/helium/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d3f4c2de2d001c51e64c085ba09969a2fded0f5
|
4
|
+
data.tar.gz: c4c1e783cc89732dd6e7d281bfb31148f32be850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eabdf72b572dcf28f331c21c7368c80c44e907dc1c6bef1179121a434b3697e036a583f25b919e1ed9bd142fdda2551e820304549e956a5b28fa22cc6cce8757
|
7
|
+
data.tar.gz: aa2c3c1509b58c03b2bf475e56fab1d9e6a34d94667602eff4b48972455437dd9aeabc9cf3bcba54abc8eab97283d07275e71bf164ce3521f77868b806c5f66b
|
data/docs/Helium.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.9.3 (ruby-2.3.1).
|
127
127
|
</div>
|
data/docs/Helium/Client.html
CHANGED
@@ -527,7 +527,7 @@
|
|
527
527
|
</div>
|
528
528
|
|
529
529
|
<div id="footer">
|
530
|
-
Generated on
|
530
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
531
531
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
532
532
|
0.9.3 (ruby-2.3.1).
|
533
533
|
</div>
|
@@ -291,7 +291,7 @@
|
|
291
291
|
</div>
|
292
292
|
|
293
293
|
<div id="footer">
|
294
|
-
Generated on
|
294
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
295
295
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
296
296
|
0.9.3 (ruby-2.3.1).
|
297
297
|
</div>
|
@@ -523,7 +523,7 @@ it will simply pass through</p>
|
|
523
523
|
</div>
|
524
524
|
|
525
525
|
<div id="footer">
|
526
|
-
Generated on
|
526
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
527
527
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
528
528
|
0.9.3 (ruby-2.3.1).
|
529
529
|
</div>
|
@@ -447,7 +447,7 @@
|
|
447
447
|
</div>
|
448
448
|
|
449
449
|
<div id="footer">
|
450
|
-
Generated on
|
450
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
451
451
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
452
452
|
0.9.3 (ruby-2.3.1).
|
453
453
|
</div>
|
@@ -241,7 +241,7 @@
|
|
241
241
|
</div>
|
242
242
|
|
243
243
|
<div id="footer">
|
244
|
-
Generated on
|
244
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
245
245
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
246
246
|
0.9.3 (ruby-2.3.1).
|
247
247
|
</div>
|
@@ -349,7 +349,7 @@
|
|
349
349
|
</div>
|
350
350
|
|
351
351
|
<div id="footer">
|
352
|
-
Generated on
|
352
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
353
353
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
354
354
|
0.9.3 (ruby-2.3.1).
|
355
355
|
</div>
|
@@ -175,7 +175,7 @@
|
|
175
175
|
</div>
|
176
176
|
|
177
177
|
<div id="footer">
|
178
|
-
Generated on
|
178
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
179
179
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
180
180
|
0.9.3 (ruby-2.3.1).
|
181
181
|
</div>
|
@@ -143,7 +143,7 @@
|
|
143
143
|
</div>
|
144
144
|
|
145
145
|
<div id="footer">
|
146
|
-
Generated on
|
146
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
147
147
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
148
148
|
0.9.3 (ruby-2.3.1).
|
149
149
|
</div>
|
data/docs/Helium/Cursor.html
CHANGED
@@ -347,7 +347,7 @@
|
|
347
347
|
</div>
|
348
348
|
|
349
349
|
<div id="footer">
|
350
|
-
Generated on
|
350
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
351
351
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
352
352
|
0.9.3 (ruby-2.3.1).
|
353
353
|
</div>
|
data/docs/Helium/DataPoint.html
CHANGED
@@ -759,7 +759,7 @@
|
|
759
759
|
</div>
|
760
760
|
|
761
761
|
<div id="footer">
|
762
|
-
Generated on
|
762
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
763
763
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
764
764
|
0.9.3 (ruby-2.3.1).
|
765
765
|
</div>
|
data/docs/Helium/Element.html
CHANGED
@@ -568,7 +568,7 @@
|
|
568
568
|
</div>
|
569
569
|
|
570
570
|
<div id="footer">
|
571
|
-
Generated on
|
571
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
572
572
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
573
573
|
0.9.3 (ruby-2.3.1).
|
574
574
|
</div>
|
data/docs/Helium/Error.html
CHANGED
@@ -255,7 +255,7 @@ response message</p>
|
|
255
255
|
</div>
|
256
256
|
|
257
257
|
<div id="footer">
|
258
|
-
Generated on
|
258
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
259
259
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
260
260
|
0.9.3 (ruby-2.3.1).
|
261
261
|
</div>
|
@@ -147,7 +147,7 @@
|
|
147
147
|
</div>
|
148
148
|
|
149
149
|
<div id="footer">
|
150
|
-
Generated on
|
150
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
151
151
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
152
152
|
0.9.3 (ruby-2.3.1).
|
153
153
|
</div>
|
data/docs/Helium/Label.html
CHANGED
@@ -544,7 +544,7 @@ we could do something like label.sensors << new_sensor</p>
|
|
544
544
|
</div>
|
545
545
|
|
546
546
|
<div id="footer">
|
547
|
-
Generated on
|
547
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
548
548
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
549
549
|
0.9.3 (ruby-2.3.1).
|
550
550
|
</div>
|
@@ -494,7 +494,7 @@
|
|
494
494
|
</div>
|
495
495
|
|
496
496
|
<div id="footer">
|
497
|
-
Generated on
|
497
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
498
498
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
499
499
|
0.9.3 (ruby-2.3.1).
|
500
500
|
</div>
|
data/docs/Helium/Resource.html
CHANGED
@@ -1607,7 +1607,7 @@
|
|
1607
1607
|
</div>
|
1608
1608
|
|
1609
1609
|
<div id="footer">
|
1610
|
-
Generated on
|
1610
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
1611
1611
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1612
1612
|
0.9.3 (ruby-2.3.1).
|
1613
1613
|
</div>
|
data/docs/Helium/Sensor.html
CHANGED
@@ -763,7 +763,7 @@
|
|
763
763
|
</div>
|
764
764
|
|
765
765
|
<div id="footer">
|
766
|
-
Generated on
|
766
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
767
767
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
768
768
|
0.9.3 (ruby-2.3.1).
|
769
769
|
</div>
|
data/docs/Helium/User.html
CHANGED
@@ -442,7 +442,7 @@
|
|
442
442
|
</div>
|
443
443
|
|
444
444
|
<div id="footer">
|
445
|
-
Generated on
|
445
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
446
446
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
447
447
|
0.9.3 (ruby-2.3.1).
|
448
448
|
</div>
|
data/docs/Helium/Utils.html
CHANGED
@@ -173,7 +173,7 @@
|
|
173
173
|
</div>
|
174
174
|
|
175
175
|
<div id="footer">
|
176
|
-
Generated on
|
176
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
177
177
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
178
178
|
0.9.3 (ruby-2.3.1).
|
179
179
|
</div>
|
data/docs/_index.html
CHANGED
@@ -307,7 +307,7 @@
|
|
307
307
|
</div>
|
308
308
|
|
309
309
|
<div id="footer">
|
310
|
-
Generated on
|
310
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
311
311
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
312
312
|
0.9.3 (ruby-2.3.1).
|
313
313
|
</div>
|
data/docs/file.README.html
CHANGED
@@ -349,7 +349,7 @@
|
|
349
349
|
</div></div>
|
350
350
|
|
351
351
|
<div id="footer">
|
352
|
-
Generated on
|
352
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
353
353
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
354
354
|
0.9.3 (ruby-2.3.1).
|
355
355
|
</div>
|
data/docs/index.html
CHANGED
@@ -349,7 +349,7 @@
|
|
349
349
|
</div></div>
|
350
350
|
|
351
351
|
<div id="footer">
|
352
|
-
Generated on
|
352
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
353
353
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
354
354
|
0.9.3 (ruby-2.3.1).
|
355
355
|
</div>
|
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Thu Sep 1 16:28:30 2016 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.3 (ruby-2.3.1).
|
108
108
|
</div>
|
data/lib/helium/client.rb
CHANGED
@@ -22,9 +22,10 @@ module Helium
|
|
22
22
|
attr_accessor :api_key
|
23
23
|
|
24
24
|
def initialize(opts = {})
|
25
|
-
@api_key
|
26
|
-
@api_host
|
27
|
-
@
|
25
|
+
@api_key = opts.fetch(:api_key)
|
26
|
+
@api_host = opts.fetch(:host, HOST)
|
27
|
+
@verify_peer = opts.fetch(:verify_peer, true)
|
28
|
+
@debug = opts.fetch(:debug, false)
|
28
29
|
end
|
29
30
|
|
30
31
|
def inspect
|
data/lib/helium/client/http.rb
CHANGED
@@ -65,10 +65,11 @@ module Helium
|
|
65
65
|
url = url_for(path)
|
66
66
|
|
67
67
|
Typhoeus::Request.new(url, {
|
68
|
-
method:
|
69
|
-
params:
|
70
|
-
headers:
|
71
|
-
|
68
|
+
method: method,
|
69
|
+
params: params,
|
70
|
+
headers: http_headers,
|
71
|
+
ssl_verifypeer: @verify_peer,
|
72
|
+
body: JSON.generate(body)
|
72
73
|
})
|
73
74
|
end
|
74
75
|
|
data/lib/helium/resource.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Helium
|
2
2
|
# Abstract base class for Helium Resources returned by the API
|
3
3
|
class Resource
|
4
|
-
attr_reader :id, :type
|
4
|
+
attr_reader :id, :type, :params
|
5
5
|
|
6
6
|
def initialize(opts = {})
|
7
7
|
@client = opts.fetch(:client)
|
@@ -24,7 +24,7 @@ module Helium
|
|
24
24
|
def all(opts = {})
|
25
25
|
client = opts.fetch(:client)
|
26
26
|
|
27
|
-
response = client.get(
|
27
|
+
response = client.get(all_path)
|
28
28
|
resources_data = JSON.parse(response.body)["data"]
|
29
29
|
|
30
30
|
resources = resources_data.map do |resource_data|
|
@@ -34,6 +34,10 @@ module Helium
|
|
34
34
|
return resources
|
35
35
|
end
|
36
36
|
|
37
|
+
def all_path
|
38
|
+
"/#{resource_name}"
|
39
|
+
end
|
40
|
+
|
37
41
|
# Finds a single Resource by id
|
38
42
|
# @param id [String] An id to find the Resource
|
39
43
|
# @option opts [Client] :client A Helium::Client
|
data/lib/helium/sensor.rb
CHANGED
@@ -10,7 +10,20 @@ module Helium
|
|
10
10
|
@ports = @params.dig('meta', 'ports')
|
11
11
|
@last_seen = @params.dig('meta', 'last-seen')
|
12
12
|
@firmware = @params.dig('meta', 'versions', 'sensor')
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.all_path
|
16
|
+
"/sensor?include=label"
|
17
|
+
end
|
13
18
|
|
19
|
+
# NOTE: currently this just returns the ids of labels. Once core returns
|
20
|
+
# all label info via includes=label, we can get rid of the
|
21
|
+
# label_relationships stuff
|
22
|
+
def labels
|
23
|
+
labels_params = Array(@params.dig('relationships', 'label', 'data'))
|
24
|
+
@labels ||= labels_params.map{ |label_params|
|
25
|
+
Label.new(client: @client, params: label_params)
|
26
|
+
}
|
14
27
|
end
|
15
28
|
|
16
29
|
def timeseries(opts = {})
|
@@ -44,7 +57,8 @@ module Helium
|
|
44
57
|
mac: mac,
|
45
58
|
ports: ports,
|
46
59
|
last_seen: last_seen,
|
47
|
-
firmware: firmware
|
60
|
+
firmware: firmware,
|
61
|
+
labels: labels
|
48
62
|
})
|
49
63
|
end
|
50
64
|
end
|
data/lib/helium/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.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-
|
12
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|