Class: TuwienLogon::UserInfo

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = []) ⇒ UserInfo

Returns a new instance of UserInfo.



12
13
14
15
# File 'lib/tuwien_logon/user_info.rb', line 12

def initialize(params = [])
  @params = params
  @info = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(param, *args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tuwien_logon/user_info.rb', line 17

def method_missing(param, *args)
  if param.to_s[-1] == '='
    setter = true
    param = param.to_s[0..-2].to_sym
  end
  
  if params.include? param
    info[param] = args[0] if setter
    info[param]
  else
    super(param, args);
  end
end

Instance Attribute Details

#infoObject

Returns the value of attribute info.



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

def info
  @info
end

#paramsObject

Returns the value of attribute params.



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

def params
  @params
end

Class Method Details

.find_by_oid(oid) ⇒ Object



6
7
8
9
# File 'lib/tuwien_logon/user_info.rb', line 6

def find_by_oid(oid)
  request = TuwienLogon::UserInfoRequest.new
  request. :oid => oid
end