helium-ruby 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/helium/client/sensors.rb +12 -0
 - data/lib/helium/resource.rb +1 -1
 - data/lib/helium/sensor.rb +2 -9
 - 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: a0feb0bd801d81b121346597573faecb51b3f635
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1de1f6aec706c502764d33e7e75c14e0780506b5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0a7d4e3ed31a5420f14ec20600bb8a03f5c7b9b13d249cd5795343f52692fb62ae56135080df6f2bd345ac95bd85926cdee2f53139980d47abd9b0eaa7130585
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: db72d8cf7cb3a40d949da06c7742dc7ed21904b89c2579b696b194c263c4bf5834be6c5fff8e5c5468f1536c3e40ee08d6e366eac11158c327fe41b50f9d2563
         
     | 
| 
         @@ -18,6 +18,18 @@ module Helium 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    return element
         
     | 
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
                  def sensor_labels(sensor)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    path = "/sensor/#{sensor.id}/label"
         
     | 
| 
      
 23 
     | 
    
         
            +
                    response = get(path)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    labels_data = JSON.parse(response.body)["data"]
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    labels = labels_data.map do |label|
         
     | 
| 
      
 27 
     | 
    
         
            +
                      Label.new(client: self, params: label)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    return labels
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       21 
33 
     | 
    
         
             
                  def sensor_timeseries(sensor, opts = {})
         
     | 
| 
       22 
34 
     | 
    
         
             
                    path = "/sensor/#{sensor.id}/timeseries"
         
     | 
| 
       23 
35 
     | 
    
         | 
    
        data/lib/helium/resource.rb
    CHANGED
    
    | 
         @@ -15,7 +15,7 @@ module Helium 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                class << self
         
     | 
| 
       17 
17 
     | 
    
         
             
                  # NOTE seems a bit out of place to be doing client work here, but it
         
     | 
| 
       18 
     | 
    
         
            -
                  # makes sense for the Eigenclass to be  
     | 
| 
      
 18 
     | 
    
         
            +
                  # makes sense for the Eigenclass to be responsible for constructing
         
     | 
| 
       19 
19 
     | 
    
         
             
                  # instances of its inheriting class.
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  # Returns all resources
         
     | 
    
        data/lib/helium/sensor.rb
    CHANGED
    
    | 
         @@ -19,14 +19,8 @@ module Helium 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  "/sensor?include=label"
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                # NOTE: currently this just returns the ids of labels. Once core returns
         
     | 
| 
       23 
     | 
    
         
            -
                # all label info via includes=label, we can get rid of the
         
     | 
| 
       24 
     | 
    
         
            -
                # label_relationships stuff
         
     | 
| 
       25 
22 
     | 
    
         
             
                def labels
         
     | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
       27 
     | 
    
         
            -
                  @labels ||= labels_params.map{ |label_params|
         
     | 
| 
       28 
     | 
    
         
            -
                     Label.new(client: @client, params: label_params)
         
     | 
| 
       29 
     | 
    
         
            -
                  }
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @client.sensor_labels(self)
         
     | 
| 
       30 
24 
     | 
    
         
             
                end
         
     | 
| 
       31 
25 
     | 
    
         | 
| 
       32 
26 
     | 
    
         
             
                def timeseries(opts = {})
         
     | 
| 
         @@ -59,8 +53,7 @@ module Helium 
     | 
|
| 
       59 
53 
     | 
    
         
             
                    name: name,
         
     | 
| 
       60 
54 
     | 
    
         
             
                    mac: mac,
         
     | 
| 
       61 
55 
     | 
    
         
             
                    ports: ports,
         
     | 
| 
       62 
     | 
    
         
            -
                    last_seen: last_seen 
     | 
| 
       63 
     | 
    
         
            -
                    labels: labels
         
     | 
| 
      
 56 
     | 
    
         
            +
                    last_seen: last_seen
         
     | 
| 
       64 
57 
     | 
    
         
             
                  })
         
     | 
| 
       65 
58 
     | 
    
         
             
                end
         
     | 
| 
       66 
59 
     | 
    
         
             
              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.14.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 
     | 
    
         
            +
            date: 2016-10-19 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: typhoeus
         
     |