Sha256: 9bcc45db6241985e594ec16fd8cc9a3dd0ea67442951146f00ac170ddcd43e80
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
module Yammer class User < Yammer::Base # Returns authenticated user's details # @!scope class def self.current result = api_handler.current_user return nil unless result.success? new(result.body) end # Creates a new user from email address # @!scope class def self.create(email) result = api_handler.create_user(:email => email) return nil unless result.created? id = result.headers[:location].split('/').last.to_i new(:id => id) end attr_accessor_deffered :first_name, :last_name, :full_name, :hire_date, :mugshot, :state, :type, :admin, :verified_admin, :expertise, :birth_date, :stats, :show_ask_for_photo, :job_title, :web_url, :url, :external_urls, :activated_at, :summary, :department, :previous_companies, :follow_general_messages, :schools, :interests, :significant_other, :network_name, :network_id, :can_broadcast, :web_preferences, :network_domains, :location, :contact, :kids_names, :guid, :name, :mugshot_url, :mugshot_url_template, :settings, :timezone # Returns user's primary email def email @email ||= begin self.contact[:email_addresses].map do |e| e[:address] if e[:type] == 'primary' end.first end end # Returns all users that this user is following def following api_handler.users_followed_by(@id) end # Returns all user's follwing this user def followers api_handler.users_following(@id) end # Updates the user attributes def update!(params) api_handler.update_user(@id, params) end end end
Version data entries
5 entries across 5 versions & 1 rubygems