Class: OpenID::Teams::Request

Inherits:
Extension
  • Object
show all
Defined in:
lib/openid/extensions/teams.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(teams) ⇒ Request

Returns a new instance of Request.



24
25
26
27
28
# File 'lib/openid/extensions/teams.rb', line 24

def initialize teams
  @ns_alias = NS_ALIAS
  @ns_uri = NS_URI
  @teams = Array(teams)
end

Instance Attribute Details

#ns_aliasObject

Returns the value of attribute ns_alias.



22
23
24
# File 'lib/openid/extensions/teams.rb', line 22

def ns_alias
  @ns_alias
end

#ns_uriObject

Returns the value of attribute ns_uri.



22
23
24
# File 'lib/openid/extensions/teams.rb', line 22

def ns_uri
  @ns_uri
end

#teamsObject

Returns the value of attribute teams.



22
23
24
# File 'lib/openid/extensions/teams.rb', line 22

def teams
  @teams
end

Class Method Details

.from_openid_request(request) ⇒ Object



30
31
32
33
34
35
# File 'lib/openid/extensions/teams.rb', line 30

def self.from_openid_request(request)
  args = request.message.get_args(NS_URI)
  return nil if {} == args
  teams = args['query_membership'].split(',')
  new(teams)
end

Instance Method Details

#get_extension_argsObject

Get the string arguments that should be added to an OpenID message for this extension.



39
40
41
42
43
# File 'lib/openid/extensions/teams.rb', line 39

def get_extension_args
  args = {}
  args['query_membership'] = @teams.join(',') unless @teams.empty?
  return args
end