helium-ruby 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -4
  3. data/docs/Helium.html +2 -2
  4. data/docs/Helium/Client.html +3 -3
  5. data/docs/Helium/Client/Configurations.html +1 -1
  6. data/docs/Helium/Client/DeviceConfigurations.html +1 -1
  7. data/docs/Helium/Client/Elements.html +1 -1
  8. data/docs/Helium/Client/Http.html +222 -39
  9. data/docs/Helium/Client/Labels.html +1 -1
  10. data/docs/Helium/Client/Organizations.html +1 -1
  11. data/docs/Helium/Client/Sensors.html +77 -5
  12. data/docs/Helium/Client/Users.html +1 -1
  13. data/docs/Helium/ClientError.html +1 -1
  14. data/docs/Helium/Collection.html +4 -4
  15. data/docs/Helium/Configuration.html +1 -1
  16. data/docs/Helium/Cursor.html +1 -1
  17. data/docs/Helium/DataPoint.html +1 -1
  18. data/docs/Helium/DeviceConfiguration.html +1 -1
  19. data/docs/Helium/Element.html +1 -1
  20. data/docs/Helium/Error.html +1 -1
  21. data/docs/Helium/InvalidApiKey.html +1 -1
  22. data/docs/Helium/Label.html +1 -1
  23. data/docs/Helium/Metadata.html +1 -1
  24. data/docs/Helium/Organization.html +1 -1
  25. data/docs/Helium/Resource.html +1 -1
  26. data/docs/Helium/Sensor.html +91 -15
  27. data/docs/Helium/Timeseries.html +1 -1
  28. data/docs/Helium/User.html +1 -1
  29. data/docs/Helium/Utils.html +1 -1
  30. data/docs/_index.html +1 -1
  31. data/docs/file.README.html +36 -4
  32. data/docs/index.html +36 -4
  33. data/docs/method_list.html +137 -113
  34. data/docs/top-level-namespace.html +1 -1
  35. data/lib/helium/client/http.rb +51 -9
  36. data/lib/helium/client/sensors.rb +14 -0
  37. data/lib/helium/collection.rb +2 -2
  38. data/lib/helium/sensor.rb +16 -0
  39. data/lib/helium/version.rb +1 -1
  40. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c67d0f22efa262651fe436bdc015bbbfe576c0a3
4
- data.tar.gz: f8413a6d0e3e128b1d591f57827f3b020e39f465
3
+ metadata.gz: 9a1c3528079c29fb5ecbbd5d094a35be35307a74
4
+ data.tar.gz: 2c668cc1dadc8cc231cf7186b385a2c2f308d586
5
5
  SHA512:
6
- metadata.gz: 52dd2b52f35eaebd5bec0f17ec69f63acf9890c799bfd3b1786bbb188289181a404dc48bcca397ae9ccb242ae5e6d9ebb496cd4a01a13fe3f7756a2f6c230831
7
- data.tar.gz: 3a13c38c722f6816392d48502a8c7fae27bfadc8a1a7f8dbfbc228fe3f6c63cb420f8d177d3cff92d24671cce74d27acccaa32c8b38959e63477652c45e59d73
6
+ metadata.gz: f99d27ae04c82ec7e880b6c93a227f7de11eb7fee9091f16644467beabbf900b6edcc0f44447c5d67d8572c6833e7664a0dfb6c4fce80557ca9a4deacb2c96be
7
+ data.tar.gz: 2d5883f2ad98e90cbc2764f0efb6af732b4453a04c112265262f1c4abb024089ccb4651fa3685290bebae130bb260a089934a20dadcce68f00e920b77ed3503b
data/README.md CHANGED
@@ -8,14 +8,15 @@
8
8
  A Ruby gem for building applications with the Helium API. [Helium](https://www.helium.com/) is an integrated platform of smart sensors, communication, edge and cloud compute that enables numerous sensing applications. For more information about the underlying REST API, check out [the Helium docs](https://docs.helium.com/).
9
9
 
10
10
 
11
- ## Helium Documentation and Community Support
11
+ ## Developer and Community Support
12
12
 
13
+ * **Helium Developer** Complete Helium developer resources can be found at [dev.helium.com](https://dev.helium.com).
13
14
 
14
- * **helium-ruby docs** - Documentation for the gem's source can be found [here](https://helium.github.io/helium-ruby/):
15
+ * **chat.helium.com** - If you have questions or ideas about how to use this code - or any part of Helium - head over the [chat.helium.com](http://chat.helium.com). We're standing by to help.
16
+
17
+ * **helium-ruby docs** - Documentation for the gem's source can be found [here](https://helium.github.io/helium-ruby/).
15
18
 
16
- * **Helium Docs** Complete documenation for all parts of Helium can be found at [docs.helium.com](https://docs/helium.com).
17
19
 
18
- * **chat.helium.com** - If you have questions or ideas about how to use this code - or any part of Helium - head over the [chat.helium.com](http://chat.helium.com). We're standing by to help.
19
20
 
20
21
 
21
22
  ## Installation
@@ -185,6 +186,40 @@ data_points.first.avg
185
186
 
186
187
  A full list of aggregation types and sizes can be found here: https://docs.helium.com/docs/timeseries#aggregations.
187
188
 
189
+ #### Live Timeseries data
190
+
191
+ If you're building a real-time application with Helium's API, you can stream live timeseries data from a sesnor.
192
+
193
+ ```ruby
194
+ sensor.live_timeseries do |data_point|
195
+ puts "timestamp: #{data_point.timestamp}"
196
+ puts "port: #{data_point.port}"
197
+ puts "value: #{data_point.value}"}
198
+ end
199
+ # => timestamp: 2017-02-09T23:29:42+00:00
200
+ # port: t
201
+ # value: 14.17
202
+ # timestamp: 2017-02-09T23:29:42+00:00
203
+ # port: h
204
+ # value: 93.0
205
+ # timestamp: 2017-02-09T23:29:42+00:00
206
+ # port: p
207
+ # value: 101173.0
208
+ ```
209
+
210
+ You can also filter live timeseries data by port, same as demonstrated above.
211
+
212
+ ```ruby
213
+ sensor.live_timeseries(port: 't') do |data_point|
214
+ puts "timestamp: #{data_point.timestamp}"
215
+ puts "port: #{data_point.port}"
216
+ puts "value: #{data_point.value}"}
217
+ end
218
+ # => timestamp: 2017-02-09T23:24:41+00:00
219
+ # port: t
220
+ # value: 14.19
221
+ ```
222
+
188
223
  #### Creating Timeseries data
189
224
 
190
225
  Data points can be written to a sensor's timeseries data.
@@ -106,7 +106,7 @@
106
106
  <dt id="VERSION-constant" class="">VERSION =
107
107
 
108
108
  </dt>
109
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.20.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
109
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.21.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
110
 
111
111
  </dl>
112
112
 
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Thu Jan 12 15:58:34 2017 by
124
+ Generated on Mon Feb 13 09:17:41 2017 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.9.5 (ruby-2.3.1).
127
127
  </div>
@@ -316,7 +316,7 @@
316
316
 
317
317
 
318
318
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Client/Sensors.html" title="Helium::Client::Sensors (module)">Sensors</a></span></h3>
319
- <p class="inherited"><span class='object_link'><a href="Client/Sensors.html#create_sensor-instance_method" title="Helium::Client::Sensors#create_sensor (method)">#create_sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor-instance_method" title="Helium::Client::Sensors#sensor (method)">#sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_device_configuration-instance_method" title="Helium::Client::Sensors#sensor_device_configuration (method)">#sensor_device_configuration</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_element-instance_method" title="Helium::Client::Sensors#sensor_element (method)">#sensor_element</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_timeseries-instance_method" title="Helium::Client::Sensors#sensor_timeseries (method)">#sensor_timeseries</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensors-instance_method" title="Helium::Client::Sensors#sensors (method)">#sensors</a></span></p>
319
+ <p class="inherited"><span class='object_link'><a href="Client/Sensors.html#create_sensor-instance_method" title="Helium::Client::Sensors#create_sensor (method)">#create_sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor-instance_method" title="Helium::Client::Sensors#sensor (method)">#sensor</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_device_configuration-instance_method" title="Helium::Client::Sensors#sensor_device_configuration (method)">#sensor_device_configuration</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_element-instance_method" title="Helium::Client::Sensors#sensor_element (method)">#sensor_element</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_live_timeseries-instance_method" title="Helium::Client::Sensors#sensor_live_timeseries (method)">#sensor_live_timeseries</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensor_timeseries-instance_method" title="Helium::Client::Sensors#sensor_timeseries (method)">#sensor_timeseries</a></span>, <span class='object_link'><a href="Client/Sensors.html#sensors-instance_method" title="Helium::Client::Sensors#sensors (method)">#sensors</a></span></p>
320
320
 
321
321
 
322
322
 
@@ -349,7 +349,7 @@
349
349
 
350
350
 
351
351
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Client/Http.html" title="Helium::Client::Http (module)">Http</a></span></h3>
352
- <p class="inherited"><span class='object_link'><a href="Client/Http.html#base_url-instance_method" title="Helium::Client::Http#base_url (method)">#base_url</a></span>, <span class='object_link'><a href="Client/Http.html#delete-instance_method" title="Helium::Client::Http#delete (method)">#delete</a></span>, <span class='object_link'><a href="Client/Http.html#get-instance_method" title="Helium::Client::Http#get (method)">#get</a></span>, <span class='object_link'><a href="Client/Http.html#paginated_get-instance_method" title="Helium::Client::Http#paginated_get (method)">#paginated_get</a></span>, <span class='object_link'><a href="Client/Http.html#patch-instance_method" title="Helium::Client::Http#patch (method)">#patch</a></span>, <span class='object_link'><a href="Client/Http.html#post-instance_method" title="Helium::Client::Http#post (method)">#post</a></span>, <span class='object_link'><a href="Client/Http.html#put-instance_method" title="Helium::Client::Http#put (method)">#put</a></span>, <span class='object_link'><a href="Client/Http.html#url_for-instance_method" title="Helium::Client::Http#url_for (method)">#url_for</a></span></p>
352
+ <p class="inherited"><span class='object_link'><a href="Client/Http.html#base_url-instance_method" title="Helium::Client::Http#base_url (method)">#base_url</a></span>, <span class='object_link'><a href="Client/Http.html#delete-instance_method" title="Helium::Client::Http#delete (method)">#delete</a></span>, <span class='object_link'><a href="Client/Http.html#get-instance_method" title="Helium::Client::Http#get (method)">#get</a></span>, <span class='object_link'><a href="Client/Http.html#paginated_get-instance_method" title="Helium::Client::Http#paginated_get (method)">#paginated_get</a></span>, <span class='object_link'><a href="Client/Http.html#patch-instance_method" title="Helium::Client::Http#patch (method)">#patch</a></span>, <span class='object_link'><a href="Client/Http.html#post-instance_method" title="Helium::Client::Http#post (method)">#post</a></span>, <span class='object_link'><a href="Client/Http.html#put-instance_method" title="Helium::Client::Http#put (method)">#put</a></span>, <span class='object_link'><a href="Client/Http.html#stream_from-instance_method" title="Helium::Client::Http#stream_from (method)">#stream_from</a></span>, <span class='object_link'><a href="Client/Http.html#url_for-instance_method" title="Helium::Client::Http#url_for (method)">#url_for</a></span></p>
353
353
 
354
354
 
355
355
 
@@ -555,7 +555,7 @@
555
555
  </div>
556
556
 
557
557
  <div id="footer">
558
- Generated on Thu Jan 12 15:58:34 2017 by
558
+ Generated on Mon Feb 13 09:17:41 2017 by
559
559
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
560
560
  0.9.5 (ruby-2.3.1).
561
561
  </div>
@@ -286,7 +286,7 @@
286
286
  </div>
287
287
 
288
288
  <div id="footer">
289
- Generated on Thu Jan 12 15:58:34 2017 by
289
+ Generated on Mon Feb 13 09:17:41 2017 by
290
290
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
291
291
  0.9.5 (ruby-2.3.1).
292
292
  </div>
@@ -455,7 +455,7 @@
455
455
  </div>
456
456
 
457
457
  <div id="footer">
458
- Generated on Thu Jan 12 15:58:34 2017 by
458
+ Generated on Mon Feb 13 09:17:41 2017 by
459
459
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
460
460
  0.9.5 (ruby-2.3.1).
461
461
  </div>
@@ -365,7 +365,7 @@
365
365
  </div>
366
366
 
367
367
  <div id="footer">
368
- Generated on Thu Jan 12 15:58:34 2017 by
368
+ Generated on Mon Feb 13 09:17:41 2017 by
369
369
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
370
370
  0.9.5 (ruby-2.3.1).
371
371
  </div>
@@ -98,8 +98,6 @@
98
98
 
99
99
  </dt>
100
100
  <dd><pre class="code"><span class='lbrace'>{</span>
101
- <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Accept</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
102
- <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
103
101
  <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>helium-ruby</span><span class='tstring_end'>&#39;</span></span>
104
102
  <span class='rbrace'>}</span></pre></dd>
105
103
 
@@ -270,6 +268,29 @@
270
268
 
271
269
  <span class="summary_desc"><div class='inline'></div></span>
272
270
 
271
+ </li>
272
+
273
+
274
+ <li class="public ">
275
+ <span class="summary_signature">
276
+
277
+ <a href="#stream_from-instance_method" title="#stream_from (instance method)">#<strong>stream_from</strong>(path, opts = {}) {|Helium::Resource| ... } &#x21d2; Object </a>
278
+
279
+
280
+
281
+ </span>
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ <span class="summary_desc"><div class='inline'><p>Stream data from the provided path.</p>
292
+ </div></span>
293
+
273
294
  </li>
274
295
 
275
296
 
@@ -320,14 +341,14 @@
320
341
  <pre class="lines">
321
342
 
322
343
 
323
- 39
324
- 40
325
- 41
326
- 42
327
- 43</pre>
344
+ 63
345
+ 64
346
+ 65
347
+ 66
348
+ 67</pre>
328
349
  </td>
329
350
  <td>
330
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 39</span>
351
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 63</span>
331
352
 
332
353
  <span class='kw'>def</span> <span class='id identifier rubyid_base_url'>base_url</span>
333
354
  <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>PROTOCOL</span><span class='embexpr_end'>}</span><span class='tstring_content'>://</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_host</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
@@ -354,13 +375,13 @@
354
375
  <pre class="lines">
355
376
 
356
377
 
378
+ 32
379
+ 33
357
380
  34
358
- 35
359
- 36
360
- 37</pre>
381
+ 35</pre>
361
382
  </td>
362
383
  <td>
363
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 34</span>
384
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 32</span>
364
385
 
365
386
  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
366
387
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='symbol'>:delete</span><span class='rparen'>)</span>
@@ -386,12 +407,12 @@
386
407
  <pre class="lines">
387
408
 
388
409
 
389
- 10
390
- 11
391
- 12</pre>
410
+ 8
411
+ 9
412
+ 10</pre>
392
413
  </td>
393
414
  <td>
394
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 10</span>
415
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 8</span>
395
416
 
396
417
  <span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
397
418
  <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='symbol'>:get</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
@@ -416,16 +437,16 @@
416
437
  <pre class="lines">
417
438
 
418
439
 
440
+ 12
441
+ 13
419
442
  14
420
443
  15
421
444
  16
422
445
  17
423
- 18
424
- 19
425
- 20</pre>
446
+ 18</pre>
426
447
  </td>
427
448
  <td>
428
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 14</span>
449
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 12</span>
429
450
 
430
451
  <span class='kw'>def</span> <span class='id identifier rubyid_paginated_get'>paginated_get</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
431
452
  <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:klass</span><span class='rparen'>)</span>
@@ -454,12 +475,12 @@
454
475
  <pre class="lines">
455
476
 
456
477
 
457
- 26
458
- 27
459
- 28</pre>
478
+ 24
479
+ 25
480
+ 26</pre>
460
481
  </td>
461
482
  <td>
462
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 26</span>
483
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 24</span>
463
484
 
464
485
  <span class='kw'>def</span> <span class='id identifier rubyid_patch'>patch</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
465
486
  <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='symbol'>:patch</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
@@ -484,12 +505,12 @@
484
505
  <pre class="lines">
485
506
 
486
507
 
487
- 22
488
- 23
489
- 24</pre>
508
+ 20
509
+ 21
510
+ 22</pre>
490
511
  </td>
491
512
  <td>
492
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 22</span>
513
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 20</span>
493
514
 
494
515
  <span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
495
516
  <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='symbol'>:post</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
@@ -514,12 +535,12 @@
514
535
  <pre class="lines">
515
536
 
516
537
 
517
- 30
518
- 31
519
- 32</pre>
538
+ 28
539
+ 29
540
+ 30</pre>
520
541
  </td>
521
542
  <td>
522
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 30</span>
543
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 28</span>
523
544
 
524
545
  <span class='kw'>def</span> <span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
525
546
  <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='symbol'>:put</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
@@ -530,9 +551,9 @@
530
551
  </div>
531
552
 
532
553
  <div class="method_details ">
533
- <h3 class="signature " id="url_for-instance_method">
554
+ <h3 class="signature " id="stream_from-instance_method">
534
555
 
535
- #<strong>url_for</strong>(path) &#x21d2; <tt>Object</tt>
556
+ #<strong>stream_from</strong>(path, opts = {}) {|Helium::Resource| ... } &#x21d2; <tt>Object</tt>
536
557
 
537
558
 
538
559
 
@@ -540,14 +561,101 @@
540
561
 
541
562
  </h3><div class="docstring">
542
563
  <div class="discussion">
543
- <p>Contructs a proper url given a path. If the path is already a full url
544
- it will simply pass through</p>
564
+ <p>Stream data from the provided path</p>
545
565
 
546
566
 
547
567
  </div>
548
568
  </div>
549
569
  <div class="tags">
570
+ <p class="tag_title">Parameters:</p>
571
+ <ul class="param">
550
572
 
573
+ <li>
574
+
575
+ <span class='name'>path</span>
576
+
577
+
578
+ <span class='type'>(<tt>String</tt>)</span>
579
+
580
+
581
+
582
+ &mdash;
583
+ <div class='inline'><p>a relative path</p>
584
+ </div>
585
+
586
+ </li>
587
+
588
+ <li>
589
+
590
+ <span class='name'>opts</span>
591
+
592
+
593
+ <span class='type'>(<tt>Hash</tt>)</span>
594
+
595
+
596
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
597
+
598
+
599
+ &mdash;
600
+ <div class='inline'><p>a customizable set of options</p>
601
+ </div>
602
+
603
+ </li>
604
+
605
+ </ul>
606
+
607
+
608
+
609
+
610
+
611
+
612
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
613
+ <ul class="option">
614
+
615
+ <li>
616
+ <span class="name">:klass</span>
617
+ <span class="type">(<tt>Class</tt>)</span>
618
+ <span class="default">
619
+
620
+ </span>
621
+
622
+ &mdash; <div class='inline'><p>a class to be initialized with received data</p>
623
+ </div>
624
+
625
+ </li>
626
+
627
+ <li>
628
+ <span class="name">:params</span>
629
+ <span class="type">(<tt>Hash</tt>)</span>
630
+ <span class="default">
631
+
632
+ </span>
633
+
634
+ &mdash; <div class='inline'><p>a hash of params to be used as query params</p>
635
+ </div>
636
+
637
+ </li>
638
+
639
+ </ul>
640
+
641
+
642
+ <p class="tag_title">Yields:</p>
643
+ <ul class="yield">
644
+
645
+ <li>
646
+
647
+
648
+ <span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Helium::Resource (class)">Helium::Resource</a></span></tt>)</span>
649
+
650
+
651
+
652
+ &mdash;
653
+ <div class='inline'><p>accepts logic to perform on the initialized Helium::Resource class</p>
654
+ </div>
655
+
656
+ </li>
657
+
658
+ </ul>
551
659
 
552
660
  </div><table class="source_code">
553
661
  <tr>
@@ -555,15 +663,90 @@ it will simply pass through</p>
555
663
  <pre class="lines">
556
664
 
557
665
 
666
+ 42
667
+ 43
668
+ 44
669
+ 45
670
+ 46
558
671
  47
559
672
  48
560
673
  49
561
674
  50
562
675
  51
563
- 52</pre>
676
+ 52
677
+ 53
678
+ 54
679
+ 55
680
+ 56
681
+ 57
682
+ 58
683
+ 59
684
+ 60
685
+ 61</pre>
686
+ </td>
687
+ <td>
688
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 42</span>
689
+
690
+ <span class='kw'>def</span> <span class='id identifier rubyid_stream_from'>stream_from</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
691
+ <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:klass</span><span class='rparen'>)</span>
692
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:params</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
693
+ <span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_request'>generate_request</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='lbrace'>{</span>
694
+ <span class='label'>method:</span> <span class='symbol'>:get</span><span class='comma'>,</span>
695
+ <span class='label'>content_type:</span> <span class='symbol'>:stream</span><span class='comma'>,</span>
696
+ <span class='label'>params:</span> <span class='id identifier rubyid_params'>params</span>
697
+ <span class='rbrace'>}</span><span class='rparen'>)</span>
698
+
699
+ <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_on_body'>on_body</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_chunk'>chunk</span><span class='op'>|</span>
700
+ <span class='kw'>if</span> <span class='id identifier rubyid_chunk'>chunk</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>data:</span><span class='regexp_end'>/</span></span>
701
+ <span class='id identifier rubyid_json_string'>json_string</span> <span class='op'>=</span> <span class='id identifier rubyid_chunk'>chunk</span><span class='lbracket'>[</span><span class='id identifier rubyid_chunk'>chunk</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='op'>..</span><span class='id identifier rubyid_chunk'>chunk</span><span class='period'>.</span><span class='id identifier rubyid_rindex'>rindex</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>}</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rbracket'>]</span>
702
+ <span class='id identifier rubyid_json_data'>json_data</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json_string'>json_string</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>data</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
703
+ <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>client:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='id identifier rubyid_json_data'>json_data</span><span class='rparen'>)</span>
704
+ <span class='kw'>yield</span> <span class='id identifier rubyid_object'>object</span>
705
+ <span class='kw'>end</span>
706
+ <span class='kw'>end</span>
707
+
708
+ <span class='id identifier rubyid_run_request'>run_request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
709
+ <span class='kw'>end</span></pre>
710
+ </td>
711
+ </tr>
712
+ </table>
713
+ </div>
714
+
715
+ <div class="method_details ">
716
+ <h3 class="signature " id="url_for-instance_method">
717
+
718
+ #<strong>url_for</strong>(path) &#x21d2; <tt>Object</tt>
719
+
720
+
721
+
722
+
723
+
724
+ </h3><div class="docstring">
725
+ <div class="discussion">
726
+ <p>Contructs a proper url given a path. If the path is already a full url
727
+ it will simply pass through</p>
728
+
729
+
730
+ </div>
731
+ </div>
732
+ <div class="tags">
733
+
734
+
735
+ </div><table class="source_code">
736
+ <tr>
737
+ <td>
738
+ <pre class="lines">
739
+
740
+
741
+ 71
742
+ 72
743
+ 73
744
+ 74
745
+ 75
746
+ 76</pre>
564
747
  </td>
565
748
  <td>
566
- <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 47</span>
749
+ <pre class="code"><span class="info file"># File 'lib/helium/client/http.rb', line 71</span>
567
750
 
568
751
  <span class='kw'>def</span> <span class='id identifier rubyid_url_for'>url_for</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
569
752
  <span class='kw'>return</span> <span class='id identifier rubyid_path'>path</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^http</span><span class='regexp_end'>/</span></span>
@@ -581,7 +764,7 @@ it will simply pass through</p>
581
764
  </div>
582
765
 
583
766
  <div id="footer">
584
- Generated on Thu Jan 12 15:58:34 2017 by
767
+ Generated on Mon Feb 13 09:17:41 2017 by
585
768
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
586
769
  0.9.5 (ruby-2.3.1).
587
770
  </div>