Sha256: 44a6f92afc6e34ce01d7325e0674d30cc8175bc302a7c0c45a344bc1c8efa347

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module Zype
  # Read more at https://docs.zype.com/v1.0/reference#device-linking
  #
  # @since 0.15.0
  class Pin < Zype::BaseModel
    # Retrieve the pin for the device
    #
    # @param linked_device_id [String]
    # @return [Hash] the device pin
    def status(linked_device_id:)
      client.execute(method: :get, path: '/pin/status', params: { linked_device_id: linked_device_id })
    end

    # Create the device pin
    #
    # @param linked_device_id [String]
    # @return [Hash] the device pin
    def acquire(linked_device_id:)
      client.execute(method: :post, path: '/pin/acquire', params: { linked_device_id: linked_device_id })
    end

    #
    # @return [Hash] the consumer
    def link(consumer_id:, pin:)
      client.execute(method: :put, path: '/pin/link', params: { consumer_id: consumer_id, pin: pin })
    end

    # @return [Hash] the consumer
    def unlink(consumer_id:, pin:)
      client.execute(method: :put, path: '/pin/unlink', params: { consumer_id: consumer_id, pin: pin })
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zype-0.20.0 lib/zype/models/pin.rb
zype-0.19.0 lib/zype/models/pin.rb
zype-0.18.0 lib/zype/models/pin.rb
zype-0.17.0 lib/zype/models/pin.rb
zype-0.16.1 lib/zype/models/pin.rb
zype-0.16.0 lib/zype/models/pin.rb
zype-0.15.0 lib/zype/models/pin.rb