README.md in helium-ruby-0.21.0 vs README.md in helium-ruby-0.22.0

- old
+ new

@@ -6,20 +6,21 @@ [![Gem Version](https://badge.fury.io/rb/helium-ruby.svg)](https://badge.fury.io/rb/helium-ruby) 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/). -## Helium Documentation and Community Support +## Developer and Community Support +* **Helium Developer** Complete Helium developer resources can be found at [dev.helium.com](https://dev.helium.com). -* **helium-ruby docs** - Documentation for the gem's source can be found [here](https://helium.github.io/helium-ruby/): +* **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. -* **Helium Docs** Complete documenation for all parts of Helium can be found at [docs.helium.com](https://docs/helium.com). +* **helium-ruby docs** - Documentation for the gem's source can be found [here](https://helium.github.io/helium-ruby/). -* **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. + ## Installation Add this line to your application's Gemfile: ```ruby @@ -182,9 +183,43 @@ data_points.first.avg # => 22.2916633036437 ``` A full list of aggregation types and sizes can be found here: https://docs.helium.com/docs/timeseries#aggregations. + +#### Live Timeseries data + +If you're building a real-time application with Helium's API, you can stream live timeseries data from a sesnor. + +```ruby +sensor.live_timeseries do |data_point| + puts "timestamp: #{data_point.timestamp}" + puts "port: #{data_point.port}" + puts "value: #{data_point.value}"} +end +# => timestamp: 2017-02-09T23:29:42+00:00 +# port: t +# value: 14.17 +# timestamp: 2017-02-09T23:29:42+00:00 +# port: h +# value: 93.0 +# timestamp: 2017-02-09T23:29:42+00:00 +# port: p +# value: 101173.0 +``` + +You can also filter live timeseries data by port, same as demonstrated above. + +```ruby +sensor.live_timeseries(port: 't') do |data_point| + puts "timestamp: #{data_point.timestamp}" + puts "port: #{data_point.port}" + puts "value: #{data_point.value}"} +end +# => timestamp: 2017-02-09T23:24:41+00:00 +# port: t +# value: 14.19 +``` #### Creating Timeseries data Data points can be written to a sensor's timeseries data.