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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ed4e6a8fbcc7e5ebe36c22b65f36e41566c2e83
4
- data.tar.gz: 94ec6f609f280d06f018a6ed4ecaa92b3f308c17
3
+ metadata.gz: 3d3f4c2de2d001c51e64c085ba09969a2fded0f5
4
+ data.tar.gz: c4c1e783cc89732dd6e7d281bfb31148f32be850
5
5
  SHA512:
6
- metadata.gz: 2efa549a8da0fe3b299822e9e1e69ece72edfd2198efebc4ba2f5696910cd6adea2305d6a966d5a4b5f8e4338bb722e6e984b14b3dec7e18015fec6221e0c06e
7
- data.tar.gz: 103c4aaafc6a18d10974648d0f0d2e6c8964f9a3a1d6ebd5dcc608aff3c2920aec2af526aa00dcc1878654c4b59e041407f664376158a7ce2698ba69c0833256
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 Wed Aug 31 12:32:54 2016 by
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>
@@ -527,7 +527,7 @@
527
527
  </div>
528
528
 
529
529
  <div id="footer">
530
- Generated on Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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>
@@ -347,7 +347,7 @@
347
347
  </div>
348
348
 
349
349
  <div id="footer">
350
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -759,7 +759,7 @@
759
759
  </div>
760
760
 
761
761
  <div id="footer">
762
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -568,7 +568,7 @@
568
568
  </div>
569
569
 
570
570
  <div id="footer">
571
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -255,7 +255,7 @@ response message</p>
255
255
  </div>
256
256
 
257
257
  <div id="footer">
258
- Generated on Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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>
@@ -544,7 +544,7 @@ we could do something like label.sensors &lt;&lt; new_sensor</p>
544
544
  </div>
545
545
 
546
546
  <div id="footer">
547
- Generated on Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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>
@@ -1607,7 +1607,7 @@
1607
1607
  </div>
1608
1608
 
1609
1609
  <div id="footer">
1610
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -763,7 +763,7 @@
763
763
  </div>
764
764
 
765
765
  <div id="footer">
766
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -442,7 +442,7 @@
442
442
  </div>
443
443
 
444
444
  <div id="footer">
445
- Generated on Wed Aug 31 12:32:54 2016 by
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>
@@ -173,7 +173,7 @@
173
173
  </div>
174
174
 
175
175
  <div id="footer">
176
- Generated on Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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>
@@ -349,7 +349,7 @@
349
349
  </div></div>
350
350
 
351
351
  <div id="footer">
352
- Generated on Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 Wed Aug 31 12:32:54 2016 by
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 = opts.fetch(:api_key)
26
- @api_host = opts.fetch(:host, HOST)
27
- @debug = opts.fetch(:debug, false)
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
@@ -65,10 +65,11 @@ module Helium
65
65
  url = url_for(path)
66
66
 
67
67
  Typhoeus::Request.new(url, {
68
- method: method,
69
- params: params,
70
- headers: http_headers,
71
- body: JSON.generate(body)
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
 
@@ -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("/#{resource_name}")
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
@@ -1,3 +1,3 @@
1
1
  module Helium
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.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.7.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-08-31 00:00:00.000000000 Z
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus