helium-ruby 0.12.0 → 0.13.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/elements.rb +2 -2
- data/lib/helium/client/organizations.rb +33 -0
- data/lib/helium/client/sensors.rb +9 -0
- data/lib/helium/organization.rb +12 -0
- data/lib/helium/sensor.rb +4 -0
- 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: a4af50ffa5000019d32db28c533de9ebbb233d4c
         | 
| 4 | 
            +
              data.tar.gz: b9c5e076c582125fba4485173f1198cba999b35b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d9be6bfe31b043fb7f5665e836c4f73a23edfedff310c50237d7886583dffc956b16d756869789e2006ea68382f30f09f07b85cd9fdab34f7c9744508fe2cffa
         | 
| 7 | 
            +
              data.tar.gz: 2a53a745a22ebcce1c0838ba847e51e318ee70ffecd037c685b7214bbe41221066e65a3f658283c069d324b48babef4d70f58989d63c06f773b59a6e79a5416a
         | 
| @@ -10,9 +10,9 @@ module Helium | |
| 10 10 | 
             
                  end
         | 
| 11 11 |  | 
| 12 12 | 
             
                  def element_sensors(element)
         | 
| 13 | 
            -
                    path = "/element/#{element.id} | 
| 13 | 
            +
                    path = "/element/#{element.id}/sensor"
         | 
| 14 14 | 
             
                    response = get(path)
         | 
| 15 | 
            -
                    sensors_data = JSON.parse(response.body)[" | 
| 15 | 
            +
                    sensors_data = JSON.parse(response.body)["data"]
         | 
| 16 16 |  | 
| 17 17 | 
             
                    sensors = sensors_data.map do |sensor|
         | 
| 18 18 | 
             
                      Sensor.new(client: self, params: sensor)
         | 
| @@ -17,6 +17,39 @@ module Helium | |
| 17 17 |  | 
| 18 18 | 
             
                    return users
         | 
| 19 19 | 
             
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  def organization_labels
         | 
| 22 | 
            +
                    response = get('/organization/label')
         | 
| 23 | 
            +
                    labels_data = JSON.parse(response.body)["data"]
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    labels = labels_data.map do |label_data|
         | 
| 26 | 
            +
                      Label.new(client: self, params: label_data)
         | 
| 27 | 
            +
                    end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                    return labels
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def organization_elements
         | 
| 33 | 
            +
                    response = get('/organization/element')
         | 
| 34 | 
            +
                    elements_data = JSON.parse(response.body)["data"]
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    elements = elements_data.map do |element_data|
         | 
| 37 | 
            +
                      Element.new(client: self, params: element_data)
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    return elements
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  def organization_sensors
         | 
| 44 | 
            +
                    response = get('/organization/sensor')
         | 
| 45 | 
            +
                    sensors_data = JSON.parse(response.body)["data"]
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                    sensors = sensors_data.map do |sensor_data|
         | 
| 48 | 
            +
                      Sensor.new(client: self, params: sensor_data)
         | 
| 49 | 
            +
                    end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                    return sensors
         | 
| 52 | 
            +
                  end
         | 
| 20 53 | 
             
                end
         | 
| 21 54 | 
             
              end
         | 
| 22 55 | 
             
            end
         | 
| @@ -9,6 +9,15 @@ module Helium | |
| 9 9 | 
             
                    Sensor.find(id, client: self)
         | 
| 10 10 | 
             
                  end
         | 
| 11 11 |  | 
| 12 | 
            +
                  def sensor_element(sensor)
         | 
| 13 | 
            +
                    path = "/sensor/#{sensor.id}/element"
         | 
| 14 | 
            +
                    response = get(path)
         | 
| 15 | 
            +
                    elementj = JSON.parse(response.body)["data"]
         | 
| 16 | 
            +
                    element = Element.new(client: self, params: elementj)
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                    return element
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 12 21 | 
             
                  def sensor_timeseries(sensor, opts = {})
         | 
| 13 22 | 
             
                    path = "/sensor/#{sensor.id}/timeseries"
         | 
| 14 23 |  | 
    
        data/lib/helium/organization.rb
    CHANGED
    
    | @@ -14,6 +14,18 @@ module Helium | |
| 14 14 | 
             
                  @client.organization_users
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 | 
            +
                def labels
         | 
| 18 | 
            +
                  @client.organization_labels
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                def elements
         | 
| 22 | 
            +
                  @client.organization_elements
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def sensors
         | 
| 26 | 
            +
                  @client.organization_sensors
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 17 29 | 
             
                def as_json
         | 
| 18 30 | 
             
                  super.merge({
         | 
| 19 31 | 
             
                    name: name,
         | 
    
        data/lib/helium/sensor.rb
    CHANGED
    
    
    
        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.13.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-13 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: typhoeus
         |