Class: Repull::GuestsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/repull/api/guests_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GuestsApi

Returns a new instance of GuestsApi.



19
20
21
# File 'lib/repull/api/guests_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/repull/api/guests_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_guest(id, opts = {}) ⇒ GuestProfile

Get guest profile Returns the full guest profile — base list-row fields plus contacts, flags, notes, risk metadata, and reservation aggregates. Aggregates main vanio’s ‘GuestService.getGuestProfile()` into the public Repull shape so SDK consumers don’t have to learn the internal schema.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

Returns:



28
29
30
31
# File 'lib/repull/api/guests_api.rb', line 28

def get_guest(id, opts = {})
  data, _status_code, _headers = get_guest_with_http_info(id, opts)
  data
end

#get_guest_with_http_info(id, opts = {}) ⇒ Array<(GuestProfile, Integer, Hash)>

Get guest profile Returns the full guest profile — base list-row fields plus contacts, flags, notes, risk metadata, and reservation aggregates. Aggregates main vanio&#39;s &#x60;GuestService.getGuestProfile()&#x60; into the public Repull shape so SDK consumers don&#39;t have to learn the internal schema.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: &#x60;native&#x60; (default), &#x60;calry&#x60;, &#x60;calry-v1&#x60;. Custom: any schema name created via &#x60;POST /v1/schema/custom&#x60;. Unknown / inactive schema names fall back to &#x60;native&#x60;.

Returns:

  • (Array<(GuestProfile, Integer, Hash)>)

    GuestProfile data, response status code and response headers



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
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/repull/api/guests_api.rb', line 39

def get_guest_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GuestsApi.get_guest ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling GuestsApi.get_guest"
  end
  # resource path
  local_var_path = '/v1/guests/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Schema'] = opts[:'x_schema'] if !opts[:'x_schema'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GuestProfile'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GuestsApi.get_guest",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GuestsApi#get_guest\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_guests(opts = {}) ⇒ GuestListResponse

List guests Cursor-paginated list of guests in the workspace. Walks ‘guests.id ASC` keyset for constant per-page cost regardless of how many guests the customer has. Use `pagination.nextCursor` from one response as the `cursor` query param of the next request. Filters: `q` (substring on name/email/phone), `has_reservation` (`true`|`false`), `listing_id` (restrict to guests with at least one reservation on that listing).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: &#x60;native&#x60; (default), &#x60;calry&#x60;, &#x60;calry-v1&#x60;. Custom: any schema name created via &#x60;POST /v1/schema/custom&#x60;. Unknown / inactive schema names fall back to &#x60;native&#x60;.

  • :cursor (String)

    Opaque cursor returned in the previous response&#39;s &#x60;pagination.nextCursor&#x60;. Omit to fetch the first page.

  • :limit (Integer)

    Max items per page. Hard cap is 100. (default to 20)

  • :q (String)

    Case-insensitive substring search on name, email, or phone.

  • :has_reservation (Boolean)

    Restrict to guests that do (&#x60;true&#x60;) or do not (&#x60;false&#x60;) have any reservation on file.

  • :listing_id (Integer)

    Restrict to guests with at least one reservation on the given internal Repull listing id.

Returns:



98
99
100
101
# File 'lib/repull/api/guests_api.rb', line 98

def list_guests(opts = {})
  data, _status_code, _headers = list_guests_with_http_info(opts)
  data
end

#list_guests_with_http_info(opts = {}) ⇒ Array<(GuestListResponse, Integer, Hash)>

List guests Cursor-paginated list of guests in the workspace. Walks &#x60;guests.id ASC&#x60; keyset for constant per-page cost regardless of how many guests the customer has. Use &#x60;pagination.nextCursor&#x60; from one response as the &#x60;cursor&#x60; query param of the next request. Filters: &#x60;q&#x60; (substring on name/email/phone), &#x60;has_reservation&#x60; (&#x60;true&#x60;|&#x60;false&#x60;), &#x60;listing_id&#x60; (restrict to guests with at least one reservation on that listing).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: &#x60;native&#x60; (default), &#x60;calry&#x60;, &#x60;calry-v1&#x60;. Custom: any schema name created via &#x60;POST /v1/schema/custom&#x60;. Unknown / inactive schema names fall back to &#x60;native&#x60;.

  • :cursor (String)

    Opaque cursor returned in the previous response&#39;s &#x60;pagination.nextCursor&#x60;. Omit to fetch the first page.

  • :limit (Integer)

    Max items per page. Hard cap is 100. (default to 20)

  • :q (String)

    Case-insensitive substring search on name, email, or phone.

  • :has_reservation (Boolean)

    Restrict to guests that do (&#x60;true&#x60;) or do not (&#x60;false&#x60;) have any reservation on file.

  • :listing_id (Integer)

    Restrict to guests with at least one reservation on the given internal Repull listing id.

Returns:

  • (Array<(GuestListResponse, Integer, Hash)>)

    GuestListResponse data, response status code and response headers



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/repull/api/guests_api.rb', line 113

def list_guests_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GuestsApi.list_guests ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling GuestsApi.list_guests, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling GuestsApi.list_guests, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/guests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'has_reservation'] = opts[:'has_reservation'] if !opts[:'has_reservation'].nil?
  query_params[:'listingId'] = opts[:'listing_id'] if !opts[:'listing_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Schema'] = opts[:'x_schema'] if !opts[:'x_schema'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GuestListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GuestsApi.list_guests",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GuestsApi#list_guests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end