Class: User

Inherits:
ApplicationRecord show all
Defined in:
app/models/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#identityObject

Returns the value of attribute identity


5
6
7
# File 'app/models/user.rb', line 5

def identity
  @identity
end

Instance Method Details

#agent_idObject


31
32
33
# File 'app/models/user.rb', line 31

def agent_id
  username
end

#agent_typeObject


27
28
29
# File 'app/models/user.rb', line 27

def agent_type
  "user"
end

#api_keyObject


15
16
17
18
19
20
21
# File 'app/models/user.rb', line 15

def api_key
  @api_key ||= if [nil, 'x'].include?(api_key_digest)
    Keycard::DigestKey.new
  else
    Keycard::DigestKey.new(api_key_digest)
  end
end

#known?Boolean


23
24
25
# File 'app/models/user.rb', line 23

def known?
  persisted?
end