Class: Mattermost::User

Inherits:
MattermostObject show all
Defined in:
lib/mattermost/user.rb

Class Method Summary collapse

Methods inherited from MattermostObject

find, find_by, #initialize, method_missing

Constructor Details

This class inherits a constructor from Mattermost::MattermostObject

Class Method Details

.all(force_refresh = false) ⇒ Object



8
9
10
11
# File 'lib/mattermost/user.rb', line 8

def self.all(force_refresh = false)
  @users = nil if force_refresh
  @users ||= all_users
end

.create_from_invite(email, password, username) ⇒ Object

Create a user from the team’s invite. Returns a user



27
28
29
30
31
# File 'lib/mattermost/user.rb', line 27

def self.create_from_invite(email, password, username)
  request = Mattermost.post("/users/create?d=&iid=#{Mattermost.team.invite_id}", 
    :body => {:allow_marketing => true, :email => email, :password => password, :username => username}.to_json)
  self.new(request.parsed_response)
end

.meObject

Returns the user that was used for authentication on Mattermost.connect



20
21
22
23
# File 'lib/mattermost/user.rb', line 20

def self.me
  request = Mattermost.get("/users/me")
  self.new(request.parsed_response)
end

.new(attributes = {}) ⇒ Object



4
5
6
# File 'lib/mattermost/user.rb', line 4

def self.new(attributes = {})
  ::User.new(attributes)
end

.status(user_ids = []) ⇒ Object

Return the status of users Statuses are “offline”, “away”, or “online”



15
16
17
# File 'lib/mattermost/user.rb', line 15

def self.status(user_ids = [])
  request = Mattermost.post("/users/status", :body => user_ids.to_json)
end