Sha256: b54421042a60161ace56b084bac2578d8858bcae3a24653e7c8ce265a8e7c471

Contents?: true

Size: 837 Bytes

Versions: 4

Compression:

Stored size: 837 Bytes

Contents

module NestConnect
  class API
    class Devices
      class Thermostat < API
        def initialize(device_id)
          @device_id = device_id
        end

        def put(body)
          connection.put do |request|
            request.url(url)
            request.headers.merge!(headers)
            request.body = body
          end
        end

        def get
          connection.get do |request|
            request.url(url)
            request.headers.merge!(headers)
          end
        end

        private

          attr_reader :device_id

          def url
            "devices/thermostats/#{device_id}"
          end

          def headers
            {
              'Content-Type' => 'application/json',
              'Authorization' => "Bearer #{access_token}"
            }
          end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nest_connect-0.1.4 lib/nest_connect/api/devices/thermostat.rb
nest_connect-0.1.3 lib/nest_connect/api/devices/thermostat.rb
nest_connect-0.1.2 lib/nest_connect/api/devices/thermostat.rb
nest_connect-0.1.1 lib/nest_connect/api/devices/thermostat.rb