Class: Gaah::Provisioning::User
- Defined in:
- lib/gaah/provisioning/user.rb
Instance Attribute Summary collapse
-
#admin ⇒ Object
readonly
Returns the value of attribute admin.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#family_name ⇒ Object
readonly
Returns the value of attribute family_name.
-
#given_name ⇒ Object
readonly
Returns the value of attribute given_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#suspended ⇒ Object
readonly
Returns the value of attribute suspended.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Attributes inherited from ApiModel
Instance Method Summary collapse
- #events(xoauth_requestor_id, options = {}) ⇒ Object
-
#initialize(entry) ⇒ User
constructor
A new instance of User.
- #marshal_dump ⇒ Object
- #marshal_load(array) ⇒ Object
- #parse_email ⇒ Object
- #to_json(*args) ⇒ Object
Methods inherited from ApiModel
Constructor Details
#initialize(entry) ⇒ User
Returns a new instance of User.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gaah/provisioning/user.rb', line 6 def initialize(entry) store_xml(entry) # Meta @id = inner_text(:id) @email = parse_email @suspended = attr_value('apps|login', 'suspended') == 'true' @admin = attr_value('apps|login', 'admin') == 'true' # Name @title = inner_text(:title) @user_name = attr_value('apps|login', 'userName') @family_name = attr_value('apps|name', 'familyName') @given_name = attr_value('apps|name', 'givenName') @email ||= "#{@user_name}@#{Gaah.domain}" end |
Instance Attribute Details
#admin ⇒ Object (readonly)
Returns the value of attribute admin.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def admin @admin end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def email @email end |
#family_name ⇒ Object (readonly)
Returns the value of attribute family_name.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def family_name @family_name end |
#given_name ⇒ Object (readonly)
Returns the value of attribute given_name.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def given_name @given_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def name @name end |
#suspended ⇒ Object (readonly)
Returns the value of attribute suspended.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def suspended @suspended end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def title @title end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
4 5 6 |
# File 'lib/gaah/provisioning/user.rb', line 4 def user_name @user_name end |
Instance Method Details
#events(xoauth_requestor_id, options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/gaah/provisioning/user.rb', line 35 def events(xoauth_requestor_id, = {}) [:email] = @email Gaah::Calendar::Api.events(xoauth_requestor_id, ) end |
#marshal_dump ⇒ Object
53 54 55 |
# File 'lib/gaah/provisioning/user.rb', line 53 def marshal_dump [@id, @suspended, @admin, @title, @user_name, @family_name, @given_name, @name, @email] end |
#marshal_load(array) ⇒ Object
57 58 59 |
# File 'lib/gaah/provisioning/user.rb', line 57 def marshal_load(array) @id, @suspended, @admin, @title, @user_name, @family_name, @given_name, @name, @email = array end |
#parse_email ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/gaah/provisioning/user.rb', line 23 def parse_email email_link = (@xml/'gd|feedLink').select { |link| link.attr('rel').end_with?('user.emailLists') }.first return nil if email_link.nil? CGI::unescape(email_link.attr('href').split('recipient=').last) end |
#to_json(*args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gaah/provisioning/user.rb', line 40 def to_json(*args) { id: @id, suspended: @suspended, admin: @admin, title: @title, user_name: @user_name, family_name: @family_name, given_name: @given_name, name: @name, }.to_json end |