Class: GuestyAPI::Users
Instance Method Summary
collapse
#initialize
Instance Method Details
#create(params:) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/guesty_api/users.rb', line 24
def create(params:)
response = @client.post url: '/users', data: params
check_response! response
single_entity response
end
|
#delete(id:) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/guesty_api/users.rb', line 41
def delete(id:)
response = @client.delete url: "/users/#{id}"
check_response! response
true
end
|
#list(params: {}) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/guesty_api/users.rb', line 5
def list(params: {})
response = @client.get(
url: '/users',
data: params,
)
check_response! response
collection_entity response
end
|
#retrieve(id: :me, fields: nil) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/guesty_api/users.rb', line 15
def retrieve(id: :me, fields: nil)
url = id == :me ? '/me' : "/users/#{id}"
response = @client.get url: url, data: { fields: fields }
check_response! response
single_entity response
end
|
#update(id: :me, params:) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/guesty_api/users.rb', line 32
def update(id: :me, params:)
url = id == :me ? '/me' : "/users/#{id}"
response = @client.put url: url, data: params
check_response! response
single_entity response
end
|