Class: Basecamp::Oauth::DeviceAuthorization

Inherits:
Data
  • Object
show all
Defined in:
lib/basecamp/oauth/device_authorization.rb

Overview

RFC 8628 device authorization response (the device/user code pair the user approves out of band).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_code:, user_code:, verification_uri:, expires_in:, interval:, verification_uri_complete: nil) ⇒ DeviceAuthorization

Returns a new instance of DeviceAuthorization.



25
26
27
28
29
30
31
32
33
34
# File 'lib/basecamp/oauth/device_authorization.rb', line 25

def initialize(
  device_code:,
  user_code:,
  verification_uri:,
  expires_in:,
  interval:,
  verification_uri_complete: nil
)
  super
end

Instance Attribute Details

#device_codeString (readonly)

The device verification code polled at the token endpoint.

Returns:

  • (String)

    the current value of device_code



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def device_code
  @device_code
end

#expires_inInteger (readonly)

Lifetime of the device/user codes in seconds.

Returns:

  • (Integer)

    the current value of expires_in



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def expires_in
  @expires_in
end

#intervalInteger (readonly)

Minimum seconds to wait between token polls (defaults to 5 when the server omits it).

Returns:

  • (Integer)

    the current value of interval



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def interval
  @interval
end

#user_codeString (readonly)

The code the user enters at the verification URI.

Returns:

  • (String)

    the current value of user_code



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def user_code
  @user_code
end

#verification_uriString (readonly)

Where the user goes to approve the request.

Returns:

  • (String)

    the current value of verification_uri



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def verification_uri
  @verification_uri
end

#verification_uri_completeString? (readonly)

The verification URI with the user code pre-filled (optional; absent when the server omits it).

Returns:

  • (String, nil)

    the current value of verification_uri_complete



17
18
19
# File 'lib/basecamp/oauth/device_authorization.rb', line 17

def verification_uri_complete
  @verification_uri_complete
end