Class: LoopsRails::Contacts
Instance Method Summary
collapse
Methods inherited from ApiResource
#initialize
Instance Method Details
permalink
#create(email:, **attributes) ⇒ Object
[View source]
3
4
5
6
7
8
9
10
11
|
# File 'lib/loops_rails/client/contacts.rb', line 3
def create(email:, **attributes)
payload = { email: email }.merge(attributes).compact
response = @conn.post("contacts/create") do |req|
req.body = payload.to_json
end
parse_response(response)
end
|
permalink
#delete(email: nil, user_id: nil) ⇒ Object
[View source]
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/loops_rails/client/contacts.rb', line 35
def delete(email: nil, user_id: nil)
raise ArgumentError, "Either email or user_id must be provided" if email.nil? && user_id.nil?
payload = { email: email, userId: user_id }.compact
response = @conn.post("contacts/delete") do |req|
req.body = payload.to_json
end
parse_response(response)
end
|
permalink
#find(email: nil, user_id: nil) ⇒ Object
[View source]
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/loops_rails/client/contacts.rb', line 23
def find(email: nil, user_id: nil)
raise ArgumentError, "Either email or user_id must be provided" if email.nil? && user_id.nil?
params = { email: email, userId: user_id }.compact
response = @conn.get("contacts/find") do |req|
req.params = params
end
parse_response(response)
end
|
permalink
#update(email:, **attributes) ⇒ Object
[View source]
13
14
15
16
17
18
19
20
21
|
# File 'lib/loops_rails/client/contacts.rb', line 13
def update(email:, **attributes)
payload = { email: email }.merge(attributes).compact
response = @conn.put("contacts/update") do |req|
req.body = payload.to_json
end
parse_response(response)
end
|