Class: GuestyAPI::Guests

Inherits:
ResourceBase show all
Defined in:
lib/guesty_api/guests.rb

Instance Method Summary collapse

Methods inherited from ResourceBase

#initialize

Constructor Details

This class inherits a constructor from GuestyAPI::ResourceBase

Instance Method Details

#create(params:) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/guesty_api/guests.rb', line 23

def create(params:)
  response = @client.post url: '/guests', data: params

  check_response! response

  single_entity response
end

#delete(id:) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/guesty_api/guests.rb', line 39

def delete(id:)
  response = @client.delete url: "/guests/#{id}"

  check_response! response

  true
end

#list(params: {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/guesty_api/guests.rb', line 5

def list(params: {})
  response = @client.get(
    url: '/guests',
    data: params,
  )
  check_response! response

  collection_entity response
end

#retrieve(id:, fields: nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/guesty_api/guests.rb', line 15

def retrieve(id:, fields: nil)
  response = @client.get url: "/guests/#{id}", data: { fields: fields }

  check_response! response

  single_entity response
end

#update(id:, params:) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/guesty_api/guests.rb', line 31

def update(id:, params:)
  response = @client.put url: "/guests/#{id}", data: params

  check_response! response

  single_entity response
end