Class: Platforms::Yammer::Api::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/platforms/yammer/api/users.rb

Overview

Users in Yammer

Since:

  • 0.1.0

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Platforms::Yammer::Api::Base

Instance Method Details

#by_email(address, options = {}, headers = {}) ⇒ Faraday::Response

Get a User by email

Parameters:

  • address (#to_s)

    email of the User

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



51
52
53
54
# File 'lib/platforms/yammer/api/users.rb', line 51

def by_email address, options={}, headers={}
  params = options.merge({ email: address })
  @connection.get "users/by_email.json", params, headers
end

#current(options = {}, headers = {}) ⇒ Faraday::Response

Get current User

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



27
28
29
# File 'lib/platforms/yammer/api/users.rb', line 27

def current options={}, headers={}
  @connection.get "users/current.json", options, headers
end

#delete(user_id, options = {}, headers = {}) ⇒ Faraday::Response

Delete an existing User (admins and verified admins only)

Parameters:

  • user_id (#to_s)

    the id of the User to update

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



101
102
103
# File 'lib/platforms/yammer/api/users.rb', line 101

def delete user_id, options={}, headers={}
  @connection.delete "users/#{user_id}.json", options, headers
end

#get_user(id, options = {}, headers = {}) ⇒ Faraday::Response

Note:

Called #get_user because of the potential confusion with

Get a User by id

GET /users.json

Parameters:

  • id (#to_s)

    id of the User

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



41
42
43
# File 'lib/platforms/yammer/api/users.rb', line 41

def get_user id, options={}, headers={}
  @connection.get "users/#{id}.json", options, headers
end

#get_users(options = {}, headers = {}) ⇒ Faraday::Response

Note:

Called #get_users because of the potential confusion with

Get Users

GET /users/.json

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



18
19
20
# File 'lib/platforms/yammer/api/users.rb', line 18

def get_users options={}, headers={}
  @connection.get "users.json", options, headers
end

#in_group(group_id, options = {}, headers = {}) ⇒ Faraday::Response

Get a Users in a Group

Parameters:

  • group_id (#to_s)

    id of the Group

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



62
63
64
# File 'lib/platforms/yammer/api/users.rb', line 62

def in_group group_id, options={}, headers={}
  @connection.get "users/in_group/#{group_id}.json", options, headers
end

#liked_message(message_id, options = {}, headers = {}) ⇒ Faraday::Response

Get Users who have liked a Message

Parameters:

  • message_id (#to_s)

    id of the Message

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



72
73
74
# File 'lib/platforms/yammer/api/users.rb', line 72

def liked_message message_id, options={}, headers={}
  @connection.get "users/liked_message/#{message_id}.json", options, headers
end

#post(body = nil, headers = {}) ⇒ Faraday::Response

Create a new User (verified admins only)

Parameters:

  • body (Hash) (defaults to: nil)

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



81
82
83
# File 'lib/platforms/yammer/api/users.rb', line 81

def post body=nil, headers={}
  @connection.post "users.json", body, headers
end

#put(user_id, options = {}, headers = {}) ⇒ Faraday::Response

Update an existing User (verified admins only)

Parameters:

  • user_id (#to_s)

    the id of the User to update

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



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

def put user_id, options={}, headers={}
  @connection.put "users/#{user_id}.json", options, headers
end