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.



5
6
7
8
9
10
11
# File 'lib/authenticated.rb', line 5

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.



3
4
5
# File 'lib/authenticated.rb', line 3

def payload
  @payload
end

#selfsdkObject

Returns the value of attribute selfsdk.



3
4
5
# File 'lib/authenticated.rb', line 3

def selfsdk
  @selfsdk
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/authenticated.rb', line 3

def status
  @status
end

#uuidObject

Returns the value of attribute uuid.



3
4
5
# File 'lib/authenticated.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#accepted?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/authenticated.rb', line 13

def accepted?
  return false if @payload.nil?

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

#to_hashObject



19
20
21
22
23
# File 'lib/authenticated.rb', line 19

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