Class: Slack::API::Users

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

Instance Attribute Summary

Attributes inherited from Base

#access_token

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Slack::API::Base

Instance Method Details

#all(page: nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/laziness/api/users.rb', line 4

def all(page: nil)
  responses = with_paging(page) do |pager|
    request :get, 'users.list', **pager.to_h
  end

  Slack::User.parse_all responses, 'members'
end

#find(id) ⇒ Object



12
13
14
15
# File 'lib/laziness/api/users.rb', line 12

def find(id)
  response = request :get, 'users.info', user: id
  Slack::User.parse response, 'user'
end

#set_activeObject



17
18
19
# File 'lib/laziness/api/users.rb', line 17

def set_active
  with_nil_response { request :post, 'users.setActive' }
end