Class: Datadog::AppSec::Contrib::Devise::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/contrib/devise/resource.rb

Overview

Class to encpasulate extracting information from a Devise resource Normally a devise resource would be an Active::Record instance

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Resource

Returns a new instance of Resource.



10
11
12
# File 'lib/datadog/appsec/contrib/devise/resource.rb', line 10

def initialize(resource)
  @resource = resource
end

Instance Method Details

#emailObject



18
19
20
# File 'lib/datadog/appsec/contrib/devise/resource.rb', line 18

def email
  extract(:email)
end

#idObject



14
15
16
# File 'lib/datadog/appsec/contrib/devise/resource.rb', line 14

def id
  extract(:id) || extract(:uuid)
end

#usernameObject



22
23
24
# File 'lib/datadog/appsec/contrib/devise/resource.rb', line 22

def username
  extract(:username)
end