Class: OpenID::UI::Request

Inherits:
Extension show all
Defined in:
lib/openid/extensions/ui.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Extension

#to_message

Constructor Details

#initialize(mode = nil, icon = nil, lang = nil) ⇒ Request

Returns a new instance of Request.



13
14
15
16
17
18
19
# File 'lib/openid/extensions/ui.rb', line 13

def initialize(mode = nil, icon = nil, lang = nil)
  @ns_alias = 'ui'
  @ns_uri = NS_URI
  @lang = lang
  @icon = icon
  @mode = mode
end

Instance Attribute Details

#iconObject

Returns the value of attribute icon.



12
13
14
# File 'lib/openid/extensions/ui.rb', line 12

def icon
  @icon
end

#langObject

Returns the value of attribute lang.



12
13
14
# File 'lib/openid/extensions/ui.rb', line 12

def lang
  @lang
end

#modeObject

Returns the value of attribute mode.



12
13
14
# File 'lib/openid/extensions/ui.rb', line 12

def mode
  @mode
end

#ns_aliasObject

Returns the value of attribute ns_alias.



12
13
14
# File 'lib/openid/extensions/ui.rb', line 12

def ns_alias
  @ns_alias
end

#ns_uriObject

Returns the value of attribute ns_uri.



12
13
14
# File 'lib/openid/extensions/ui.rb', line 12

def ns_uri
  @ns_uri
end

Class Method Details

.from_openid_request(oid_req) ⇒ Object

Instantiate a Request object from the arguments in a checkid_* OpenID message return nil if the extension was not requested.



32
33
34
35
36
37
38
39
40
# File 'lib/openid/extensions/ui.rb', line 32

def self.from_openid_request(oid_req)
  ui_req = new
  args = oid_req.message.get_args(NS_URI)
  if args == {}
    return nil
  end
  ui_req.parse_extension_args(args)
  return ui_req
end

Instance Method Details

#get_extension_argsObject



21
22
23
24
25
26
27
# File 'lib/openid/extensions/ui.rb', line 21

def get_extension_args
  ns_args = {}
  ns_args['lang'] = @lang if @lang
  ns_args['icon'] = @icon if @icon
  ns_args['mode'] = @mode if @mode
  return ns_args
end

#parse_extension_args(args) ⇒ Object

Set UI extension parameters



43
44
45
46
47
# File 'lib/openid/extensions/ui.rb', line 43

def parse_extension_args(args)
  @lang = args["lang"]
  @icon = args["icon"]
  @mode = args["mode"]
end