Class: GoSso::User

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

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ User

Returns a new instance of User.



2
3
4
# File 'lib/go_sso/user.rb', line 2

def initialize(attrs)
  @attrs = attrs
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/go_sso/user.rb', line 14

def method_missing(m, *args, &block)
  method_name = m.to_s
  if @attrs.has_key?(method_name)
    @attrs[method_name]
  else
    super
  end
end

Instance Method Details

#applicationsObject



10
11
12
# File 'lib/go_sso/user.rb', line 10

def applications
  @attrs['applications'] || []
end

#can_access?(app_name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/go_sso/user.rb', line 6

def can_access?(app_name)
  applications.include?(app_name.to_s)
end