Class: Repull::ReservationsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReservationsApi

Returns a new instance of ReservationsApi.



19
20
21
# File 'lib/repull/api/reservations_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/reservations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_reservation(id, opts = {}) ⇒ Reservation

Get reservation details Returns the full record for a single reservation, scoped to the authenticated workspace. Response shape is identical to a single row in GET /v1/reservations so SDK consumers can use the same type for both. Returns 404 if the id does not exist OR belongs to a different workspace — the API never differentiates the two so caller can't enumerate other workspaces' ids.

Parameters:

  • id (Integer)

    Internal Repull reservation ID.

  • 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/reservations_api.rb', line 28

def get_reservation(id, opts = {})
  data, _status_code, _headers = get_reservation_with_http_info(id, opts)
  data
end

#get_reservation_with_http_info(id, opts = {}) ⇒ Array<(Reservation, Integer, Hash)>

Get reservation details Returns the full record for a single reservation, scoped to the authenticated workspace. Response shape is identical to a single row in `GET /v1/reservations` so SDK consumers can use the same type for both. Returns 404 if the id does not exist OR belongs to a different workspace — the API never differentiates the two so caller can't enumerate other workspaces' ids.

Parameters:

  • id (Integer)

    Internal Repull reservation ID.

  • 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:

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

    Reservation 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/reservations_api.rb', line 39

def get_reservation_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReservationsApi.get_reservation ...'
  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 ReservationsApi.get_reservation"
  end
  # resource path
  local_var_path = '/v1/reservations/{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] || 'Reservation'

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

  new_options = opts.merge(
    :operation => :"ReservationsApi.get_reservation",
    :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: ReservationsApi#get_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_reservations(opts = {}) ⇒ ReservationListResponse

List reservations Cursor-paginated list of reservations across all connected PMS platforms. Filter by platform, status, listing, or check-in date range. Pagination: Walk pages with ?cursor= — pass pagination.nextCursor from one response back as ?cursor= on the next request. Stop when pagination.hasMore is false. limit defaults to 50, max 100; requesting more returns 422 (no silent truncation). ?offset= is also accepted as a first-class alias for shallow paging (0..10000) — see the offset parameter below. Mutually exclusive with cursor. For deep pagination cursor remains O(1) per page; offset > 10000 returns 422 with a docs link.

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: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :limit (Integer)

    Page size (max 100). Requests over the cap return 422. (default to 50)

  • :cursor (String)

    Opaque cursor returned in the previous response's `pagination.nextCursor`. Omit to fetch the first page.

  • :offset (Integer)

    First-class alias for cursor-based pagination. Mutually exclusive with `cursor` — passing both returns 422. Accepts integers in `[0, 10000]`; deeper walks must use `cursor` (constant per-page cost). The response always includes `pagination.next_cursor` so consumers can switch from offset → cursor mid-walk for deep pagination without re-keying. (default to 0)

  • :platform (String)

    Filter by booking platform

  • :status (String)

    Filter by lifecycle status. Case-insensitive — `confirmed`, `Confirmed`, and `CONFIRMED` all match. Each public value expands to the full set of internal sub-states server-side: `confirmed` matches `accept`/`confirmed`/`modified`, `cancelled` matches every cancellation sub-state (`cancelled_by_host`, `declined`, `expired`, etc.), `pending` includes `inquiry`/`awaiting_payment`. `completed` is a derived state — combine `status=confirmed` with `check_out_before=<today>` to filter for past stays.

  • :listing_id (Integer)

    Filter to a single listing

  • :check_in_after (Date)

    Check-in date >= this value

  • :check_in_before (Date)

    Check-in date <= this value

  • :check_out_after (Date)

    Check-out date >= this value

  • :check_out_before (Date)

    Check-out date <= this value

  • :check_in_from (Date)

    Deprecated alias for `check_in_after`.

  • :check_in_to (Date)

    Deprecated alias for `check_in_before`.

  • :check_in_after2 (Date)

    Use `check_in_after` (snake_case) instead.

  • :check_in_before2 (Date)

    Use `check_in_before` (snake_case) instead.

  • :check_out_after2 (Date)

    Use `check_out_after` (snake_case) instead.

  • :check_out_before2 (Date)

    Use `check_out_before` (snake_case) instead.

  • :include_total (Boolean)

    When `true` (default), the response's `pagination.total` carries the count of rows matching the current filter, across all pages. Pass `false` to skip the count for very large workspaces where the per-page COUNT(*) cost matters. (default to true)

Returns:



110
111
112
113
# File 'lib/repull/api/reservations_api.rb', line 110

def list_reservations(opts = {})
  data, _status_code, _headers = list_reservations_with_http_info(opts)
  data
end

#list_reservations_with_http_info(opts = {}) ⇒ Array<(ReservationListResponse, Integer, Hash)>

List reservations Cursor-paginated list of reservations across all connected PMS platforms. Filter by platform, status, listing, or check-in date range. Pagination: Walk pages with `?cursor=` — pass `pagination.nextCursor` from one response back as `?cursor=` on the next request. Stop when `pagination.hasMore` is `false`. `limit` defaults to 50, max 100; requesting more returns 422 (no silent truncation). `?offset=` is also accepted as a first-class alias for shallow paging (0..10000) — see the `offset` parameter below. Mutually exclusive with `cursor`. For deep pagination cursor remains O(1) per page; offset > 10000 returns 422 with a docs link.

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: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :limit (Integer)

    Page size (max 100). Requests over the cap return 422. (default to 50)

  • :cursor (String)

    Opaque cursor returned in the previous response's `pagination.nextCursor`. Omit to fetch the first page.

  • :offset (Integer)

    First-class alias for cursor-based pagination. Mutually exclusive with `cursor` — passing both returns 422. Accepts integers in `[0, 10000]`; deeper walks must use `cursor` (constant per-page cost). The response always includes `pagination.next_cursor` so consumers can switch from offset → cursor mid-walk for deep pagination without re-keying. (default to 0)

  • :platform (String)

    Filter by booking platform

  • :status (String)

    Filter by lifecycle status. Case-insensitive — `confirmed`, `Confirmed`, and `CONFIRMED` all match. Each public value expands to the full set of internal sub-states server-side: `confirmed` matches `accept`/`confirmed`/`modified`, `cancelled` matches every cancellation sub-state (`cancelled_by_host`, `declined`, `expired`, etc.), `pending` includes `inquiry`/`awaiting_payment`. `completed` is a derived state — combine `status=confirmed` with `check_out_before=<today>` to filter for past stays.

  • :listing_id (Integer)

    Filter to a single listing

  • :check_in_after (Date)

    Check-in date >= this value

  • :check_in_before (Date)

    Check-in date <= this value

  • :check_out_after (Date)

    Check-out date >= this value

  • :check_out_before (Date)

    Check-out date <= this value

  • :check_in_from (Date)

    Deprecated alias for `check_in_after`.

  • :check_in_to (Date)

    Deprecated alias for `check_in_before`.

  • :check_in_after2 (Date)

    Use `check_in_after` (snake_case) instead.

  • :check_in_before2 (Date)

    Use `check_in_before` (snake_case) instead.

  • :check_out_after2 (Date)

    Use `check_out_after` (snake_case) instead.

  • :check_out_before2 (Date)

    Use `check_out_before` (snake_case) instead.

  • :include_total (Boolean)

    When `true` (default), the response's `pagination.total` carries the count of rows matching the current filter, across all pages. Pass `false` to skip the count for very large workspaces where the per-page COUNT(*) cost matters. (default to true)

Returns:

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

    ReservationListResponse data, response status code and response headers



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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/repull/api/reservations_api.rb', line 137

def list_reservations_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReservationsApi.list_reservations ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ReservationsApi.list_reservations, 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 ReservationsApi.list_reservations, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling ReservationsApi.list_reservations, must be smaller than or equal to 10000.'
  end

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

  allowable_values = ["confirmed", "pending", "cancelled", "completed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/reservations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'listingId'] = opts[:'listing_id'] if !opts[:'listing_id'].nil?
  query_params[:'check_in_after'] = opts[:'check_in_after'] if !opts[:'check_in_after'].nil?
  query_params[:'check_in_before'] = opts[:'check_in_before'] if !opts[:'check_in_before'].nil?
  query_params[:'check_out_after'] = opts[:'check_out_after'] if !opts[:'check_out_after'].nil?
  query_params[:'check_out_before'] = opts[:'check_out_before'] if !opts[:'check_out_before'].nil?
  query_params[:'checkInFrom'] = opts[:'check_in_from'] if !opts[:'check_in_from'].nil?
  query_params[:'checkInTo'] = opts[:'check_in_to'] if !opts[:'check_in_to'].nil?
  query_params[:'checkInAfter'] = opts[:'check_in_after2'] if !opts[:'check_in_after2'].nil?
  query_params[:'checkInBefore'] = opts[:'check_in_before2'] if !opts[:'check_in_before2'].nil?
  query_params[:'checkOutAfter'] = opts[:'check_out_after2'] if !opts[:'check_out_after2'].nil?
  query_params[:'checkOutBefore'] = opts[:'check_out_before2'] if !opts[:'check_out_before2'].nil?
  query_params[:'include_total'] = opts[:'include_total'] if !opts[:'include_total'].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] || 'ReservationListResponse'

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

  new_options = opts.merge(
    :operation => :"ReservationsApi.list_reservations",
    :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: ReservationsApi#list_reservations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end