Sha256: 1cb4749cf1017d45360cb0d421989bc2eb1802fa1e4815e8f99a8c1e20bba877

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

module NestConnect
  class API
    class Devices
      class Structure < API
        def initialize(structure_id)
          @structure_id = structure_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 :structure_id

          def url
            "devices/structures/#{structure_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/structure.rb
nest_connect-0.1.3 lib/nest_connect/api/devices/structure.rb
nest_connect-0.1.2 lib/nest_connect/api/devices/structure.rb
nest_connect-0.1.1 lib/nest_connect/api/devices/structure.rb