-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp_connections.rb
More file actions
75 lines (62 loc) · 1.61 KB
/
app_connections.rb
File metadata and controls
75 lines (62 loc) · 1.61 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# frozen_string_literal: true
require "net/http"
require "uri"
module EmbedWorkflow
module AppConnections
class << self
include Base
include Client
RESOURCE_BASE_PATH = "#{BASE_API_PATH}/app_connections".freeze
def list(user_key: nil, starting_after: nil, ending_before: nil, limit: nil)
params = {
user_key: user_key,
starting_after: starting_after,
ending_before: ending_before,
limit: limit
}.compact
get_request(
path: RESOURCE_BASE_PATH,
params: params
)
end
def fetch(id:, user_key: nil)
params = { user_key: user_key }.compact
get_request(
path: "#{RESOURCE_BASE_PATH}/#{id}",
params: params
)
end
def create(name:, app_type:, config:, user_key: nil)
attrs = {
name: name,
app_type: app_type,
config: config,
user_key: user_key
}.compact
post_request(
path: RESOURCE_BASE_PATH,
body: attrs
)
end
def update(id:, name: nil, app_type: nil, config: nil, user_key: nil)
attrs = {
name: name,
app_type: app_type,
config: config,
user_key: user_key
}.compact
put_request(
path: "#{RESOURCE_BASE_PATH}/#{id}",
body: attrs
)
end
def delete(id:, user_key: nil)
params = { user_key: user_key }.compact
delete_request(
path: "#{RESOURCE_BASE_PATH}/#{id}",
params: params
)
end
end
end
end