Class: SelfSDK::Authenticated

Inherits:
Object
  • Object
show all
Defined in:
lib/authenticated.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Authenticated

Returns a new instance of Authenticated.

[View source]

7
8
9
10
11
12
13
# File 'lib/authenticated.rb', line 7

def initialize(payload)
  return if payload.nil?

  @payload = payload
  @uuid = payload[:cid]
  @selfsdk = payload[:sub]
end

Instance Attribute Details

#payloadObject

Returns the value of attribute payload.


5
6
7
# File 'lib/authenticated.rb', line 5

def payload
  @payload
end

#selfsdkObject

Returns the value of attribute selfsdk.


5
6
7
# File 'lib/authenticated.rb', line 5

def selfsdk
  @selfsdk
end

#statusObject

Returns the value of attribute status.


5
6
7
# File 'lib/authenticated.rb', line 5

def status
  @status
end

#uuidObject

Returns the value of attribute uuid.


5
6
7
# File 'lib/authenticated.rb', line 5

def uuid
  @uuid
end

Instance Method Details

#accepted?Boolean

Returns:

  • (Boolean)
[View source]

15
16
17
18
19
# File 'lib/authenticated.rb', line 15

def accepted?
  return false if @payload.nil?

  @payload[:status] == "accepted"
end

#to_hashObject

[View source]

21
22
23
24
25
# File 'lib/authenticated.rb', line 21

def to_hash
  { uuid: @uuid,
    selfsdk: @selfsdk,
    accepted: accepted? }
end