Class: GoogleAppsApi::UserEntity

Inherits:
Entity
  • Object
show all
Defined in:
lib/google_apps_api/provisioning.rb

Constant Summary

Constants inherited from Entity

Entity::VALID_ENTITY_TYPES

Instance Attribute Summary collapse

Attributes inherited from Entity

#id, #kind

Instance Method Summary collapse

Methods inherited from Entity

#==, #full_id, #full_id_escaped, #id_escaped, #qualified_id, #qualified_id_escaped

Constructor Details

#initialize(*args) ⇒ UserEntity

Returns a new instance of UserEntity.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/google_apps_api/provisioning.rb', line 81

def initialize(*args)
  options = args.extract_options!
  if (_xml = options[:xml])
    xml = _xml.at_css("entry") || _xml
    @kind = "user"
    @id = xml.at_css("apps|login").attribute("userName").content
    @domain = xml.at_css("id").content.gsub(/^.+\/feeds\/([^\/]+)\/.+$/,"\\1")

    @family_name = xml.at_css("apps|name").attribute("familyName").content
    @given_name = xml.at_css("apps|name").attribute("givenName").content
    @suspended = xml.at_css("apps|login").attribute("suspended").content
    @ip_whitelisted = xml.at_css("apps|login").attribute("ipWhitelisted").content
    @admin = xml.at_css("apps|login").attribute("admin").content
    @change_password_at_next_login = xml.at_css("apps|login").attribute("changePasswordAtNextLogin").content
    @agreed_to_terms = xml.at_css("apps|login").attribute("agreedToTerms").content
    @quota_limit = xml.at_css("apps|quota").attribute("limit").content
  else
    if args.first.kind_of?(String)
      super(:user => args.first)
    else
      super(options.merge(:kind => "user"))
    end
  end
end

Instance Attribute Details

#adminObject

Returns the value of attribute admin.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def admin
  @admin
end

#agreed_to_termsObject

Returns the value of attribute agreed_to_terms.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def agreed_to_terms
  @agreed_to_terms
end

#change_password_at_next_loginObject

Returns the value of attribute change_password_at_next_login.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def 
  @change_password_at_next_login
end

#domainObject

Returns the value of attribute domain.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def domain
  @domain
end

#family_nameObject

Returns the value of attribute family_name.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def family_name
  @family_name
end

#given_nameObject

Returns the value of attribute given_name.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def given_name
  @given_name
end

#ip_whitelistedObject

Returns the value of attribute ip_whitelisted.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def ip_whitelisted
  @ip_whitelisted
end

#quota_limitObject

Returns the value of attribute quota_limit.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def quota_limit
  @quota_limit
end

#suspendedObject

Returns the value of attribute suspended.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def suspended
  @suspended
end

#usernameObject

Returns the value of attribute username.



79
80
81
# File 'lib/google_apps_api/provisioning.rb', line 79

def username
  @username
end

Instance Method Details

#entity_for_base_calendarObject



106
107
108
# File 'lib/google_apps_api/provisioning.rb', line 106

def entity_for_base_calendar
  CalendarEntity.new(self.full_id)
end

#get_base_calendar(c_api, *args) ⇒ Object



110
111
112
# File 'lib/google_apps_api/provisioning.rb', line 110

def get_base_calendar(c_api, *args)
  c_api.retrieve_calendar_for_user(self.entity_for_base_calendar, self, *args)
end

#get_calendars(c_api, *args) ⇒ Object



114
115
116
# File 'lib/google_apps_api/provisioning.rb', line 114

def get_calendars(c_api, *args)
  c_api.retrieve_calendars_for_user(self, *args)
end