Class: GemContribute::Auth::DeviceCode

Inherits:
Data
  • Object
show all
Defined in:
lib/gem_contribute/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#device_codeObject (readonly)

Returns the value of attribute device_code

Returns:

  • (Object)

    the current value of device_code



32
33
34
# File 'lib/gem_contribute/auth.rb', line 32

def device_code
  @device_code
end

#expires_atObject (readonly)

Returns the value of attribute expires_at

Returns:

  • (Object)

    the current value of expires_at



32
33
34
# File 'lib/gem_contribute/auth.rb', line 32

def expires_at
  @expires_at
end

#intervalObject (readonly)

Returns the value of attribute interval

Returns:

  • (Object)

    the current value of interval



32
33
34
# File 'lib/gem_contribute/auth.rb', line 32

def interval
  @interval
end

#user_codeObject (readonly)

Returns the value of attribute user_code

Returns:

  • (Object)

    the current value of user_code



32
33
34
# File 'lib/gem_contribute/auth.rb', line 32

def user_code
  @user_code
end

#verification_uriObject (readonly)

Returns the value of attribute verification_uri

Returns:

  • (Object)

    the current value of verification_uri



32
33
34
# File 'lib/gem_contribute/auth.rb', line 32

def verification_uri
  @verification_uri
end

Instance Method Details

#expired?(now: Time.now) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/gem_contribute/auth.rb', line 33

def expired?(now: Time.now)
  now >= expires_at
end

#with_interval(new_interval) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/gem_contribute/auth.rb', line 37

def with_interval(new_interval)
  self.class.new(
    device_code: device_code,
    user_code: user_code,
    verification_uri: verification_uri,
    expires_at: expires_at,
    interval: new_interval
  )
end