Class: Symgate::Auth::User

Inherits:
Type
  • Object
show all
Defined in:
lib/symgate/auth/user.rb

Overview

defines a symgate user

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#==, hash_value_with_optional_namespace

Constructor Details

#initialize(opts = {}) ⇒ User

Returns a new instance of User.



7
8
9
10
# File 'lib/symgate/auth/user.rb', line 7

def initialize(opts = {})
  super(opts)
  @is_group_admin = opts[:is_group_admin] || false
end

Class Method Details

.from_soap(hash) ⇒ Object



12
13
14
15
16
17
# File 'lib/symgate/auth/user.rb', line 12

def self.from_soap(hash)
  Symgate::Auth::User.new(
    user_id: hash[:@id],
    is_group_admin: hash[:@is_group_admin] == 'true'
  )
end

Instance Method Details

#to_sObject



26
27
28
# File 'lib/symgate/auth/user.rb', line 26

def to_s
  @user_id + (@is_group_admin ? '(admin)' : '')
end

#to_soap(hash) ⇒ Object



19
20
21
22
23
24
# File 'lib/symgate/auth/user.rb', line 19

def to_soap(hash)
  hash[:'auth:user'] = ''
  hash[:attributes!] = {} unless hash.include? :attributes!
  hash[:attributes!][:'auth:user'] = { id: @user_id }
  hash[:attributes!][:'auth:user'][:isGroupAdmin] = @is_group_admin if @is_group_admin
end