Module: Yammer::Api::User

Included in:
Client
Defined in:
lib/yammer/api/user.rb

Instance Method Summary collapse

Instance Method Details

#all_users(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch users from the authenticated user's network

Yammer.all_users

Parameters:

  • opts (Hash) (defaults to: {})

    A customizable set of opts.

Options Hash (opts):

  • :page (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



127
128
129
# File 'lib/yammer/api/user.rb', line 127

def all_users(opts={})
  get("/api/v1/users", opts)
end

#create_user(opts = {}) ⇒ Yammer::ApiResponse

Examples:

create a user with the email [email protected]

Yammer.create_user('[email protected]')

Parameters:

  • opts (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (opts):

  • :email (String)
  • :full_name (String)
  • :guid (String)
  • :job_title (String)
  • :location (String)
  • :im_provider (String)
  • :im_username (String)
  • :work_telephone (String)
  • :work_extension (String)
  • :mobile_telephone (String)
  • :external_profiles (String)
  • :significant_other (String)
  • :kids_names (String)
  • :interests (String)
  • :summary (String)
  • :expertise (String)
  • :schools_csv (String)
  • :previous_companies_csv (String)
  • :preferred_my_feed (String)
  • :sticky_my_feed (String)
  • :prescribed_my_feed (String)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



34
35
36
# File 'lib/yammer/api/user.rb', line 34

def create_user(opts={})
  post("/api/v1/users", opts)
end

#current_userYammer::ApiResponse

Examples:

Fetch data for the authenticated user

Yammer.current_user

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



114
115
116
# File 'lib/yammer/api/user.rb', line 114

def current_user
  get("/api/v1/users/current")
end

#delete_user(id) ⇒ Yammer::ApiResponse

Examples:

Delete user with ID 2

Yammer.delete_user(2)

Parameters:

  • id (Integer, String)

    A Yammer user ID

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



79
80
81
# File 'lib/yammer/api/user.rb', line 79

def delete_user(id)
  delete("/api/v1/users/#{id}")
end

#get_user(id) ⇒ Yammer::ApiResponse

Examples:

Fetch data user with ID 2

Yammer.get_user(2)

Parameters:

  • id (Integer, String)

    A Yammer user ID

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



91
92
93
# File 'lib/yammer/api/user.rb', line 91

def get_user(id)
  get("/api/v1/users/#{id}")
end

#get_user_by_email(email) ⇒ Yammer::ApiResponse

Examples:

Fetch data user with email [email protected]

Yammer.get_user_by_email('[email protected]')

Parameters:

  • email (Integer, String)

    A Yammer user ID

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



103
104
105
# File 'lib/yammer/api/user.rb', line 103

def get_user_by_email(email)
  get("/api/v1/users/by_email", :email => email)
end

#update_user(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

update info for a user with the email [email protected]

Yammer.update_user(1, :job_title => 'software engineer')

Parameters:

  • opts (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (opts):

  • :email (String)
  • :full_name (String)
  • :guid (String)
  • :job_title (String)
  • :location (String)
  • :im_provider (String)
  • :im_username (String)
  • :work_telephone (String)
  • :work_extension (String)
  • :mobile_telephone (String)
  • :external_profiles (String)
  • :significant_other (String)
  • :kids_names (String)
  • :interests (String)
  • :summary (String)
  • :expertise (String)
  • :schools_csv (String)
  • :previous_companies_csv (String)
  • :preferred_my_feed (String)
  • :sticky_my_feed (String)
  • :prescribed_my_feed (String)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



67
68
69
# File 'lib/yammer/api/user.rb', line 67

def update_user(id, opts={})
  put("/api/v1/users/#{id}", opts)
end

#users_followed_by(id) ⇒ Yammer::ApiResponse

Examples:

Fetch users from the authenticated user's network followed by the user whose ID is provided

Yammer.users_followed(1)

Parameters:

  • id (Integer)

    the ID of the user for whom you want to get the users being followed

Returns:

Raises:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



149
150
151
# File 'lib/yammer/api/user.rb', line 149

def users_followed_by(id)
  get("/api/v1/users/followed_by/#{id}")
end

#users_following(id) ⇒ Yammer::ApiResponse

Examples:

Fetch users from the authenticated user's network following user whose ID is provided

Yammer.users_following(1)

Parameters:

  • id (Integer)

    the ID of the user whose followers you want to get

Returns:

Raises:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



138
139
140
# File 'lib/yammer/api/user.rb', line 138

def users_following(id)
  get("/api/v1/users/following/#{id}")
end