Class: GuestyAPI::Listings

Inherits:
ResourceBase show all
Defined in:
lib/guesty_api/listings.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



21
22
23
24
25
26
27
# File 'lib/guesty_api/listings.rb', line 21

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

  check_response! response

  single_entity response
end

#list(params: {}) ⇒ Object



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

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

  check_response! response

  collection_entity response
end

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



13
14
15
16
17
18
19
# File 'lib/guesty_api/listings.rb', line 13

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

  check_response! response

  single_entity response
end

#update(id:, params:) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/guesty_api/listings.rb', line 29

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

  check_response! response

  single_entity response
end