-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusers.rb
More file actions
51 lines (42 loc) · 1.04 KB
/
users.rb
File metadata and controls
51 lines (42 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true
require "net/http"
require "uri"
module EmbedWorkflow
module Users
class << self
include Base
include Client
RESOURCE_BASE_PATH = "#{BASE_API_PATH}/users".freeze
def upsert(key:, name: nil, email: nil, data: nil, groups: nil)
attrs = {
key: key,
name: name,
email: email,
data: data,
groups: groups
}.compact
put_request(
path: "#{RESOURCE_BASE_PATH}/#{key}",
body: attrs
)
end
def fetch(key:)
get_request(path: "#{RESOURCE_BASE_PATH}/#{key}")
end
def list(starting_after: nil, ending_before: nil, limit: nil)
params = {
starting_after: starting_after,
ending_before: ending_before,
limit: limit
}.compact
get_request(
path: RESOURCE_BASE_PATH,
params: params
)
end
def delete(key:)
delete_request(path: "#{RESOURCE_BASE_PATH}/#{key}")
end
end
end
end