Class: Repull::ReviewsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReviewsApi

Returns a new instance of ReviewsApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_review(id, opts = {}) ⇒ Review

Get review Returns one review (the bare ‘Review` object — NOT wrapped in `{ data: … }`). Scoped to the authenticated workspace via the listings join — reviews that don’t belong to the workspace return 404 (we don’t differentiate to avoid leaking other customers’ ids).

Parameters:

  • id (Integer)

    Internal Repull review 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/reviews_api.rb', line 28

def get_review(id, opts = {})
  data, _status_code, _headers = get_review_with_http_info(id, opts)
  data
end

#get_review_with_http_info(id, opts = {}) ⇒ Array<(Review, Integer, Hash)>

Get review Returns one review (the bare &#x60;Review&#x60; object — NOT wrapped in &#x60;{ data: … }&#x60;). Scoped to the authenticated workspace via the listings join — reviews that don&#39;t belong to the workspace return 404 (we don&#39;t differentiate to avoid leaking other customers&#39; ids).

Parameters:

  • id (Integer)

    Internal Repull review 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: &#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<(Review, Integer, Hash)>)

    Review 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/reviews_api.rb', line 39

def get_review_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.get_review ...'
  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 ReviewsApi.get_review"
  end
  # resource path
  local_var_path = '/v1/reviews/{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] || 'Review'

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

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

#list_reviews(opts = {}) ⇒ ReviewListResponse

List reviews Cursor-paginated guest + host review stream for the workspace. Backed by main vanio’s unified ‘reviews` table (populated by per-channel backfill crons), so this surface returns the complete cross-channel history — separate from `/v1/channels/airbnb/reviews` which hits Airbnb live. Filters: `platform` (`airbnb`|`booking`|`vrbo`), `listing_id` (internal Repull listing id), `rating_min` / `rating_max` (inclusive bounds, 0..5), `status` (`responded`|`unanswered`|`all`), `reviewer_role` (`guest` (default) | `host` | `all`).

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;.

  • :limit (Integer) — default: default to 20
  • :platform (String)
  • :listing_id (Integer)

    Restrict to one internal Repull listing.

  • :rating_min (Float)
  • :rating_max (Float)
  • :status (String)

    &#x60;responded&#x60; — host has replied. &#x60;unanswered&#x60; — host has not replied. &#x60;all&#x60; — no filter.

  • :reviewer_role (String)

    &#x60;guest&#x60; (default) — reviews written by guests about the host/property. &#x60;host&#x60; — reviews written by the host about guests. &#x60;all&#x60; — both. (default to ‘guest’)

Returns:



101
102
103
104
# File 'lib/repull/api/reviews_api.rb', line 101

def list_reviews(opts = {})
  data, _status_code, _headers = list_reviews_with_http_info(opts)
  data
end

#list_reviews_with_http_info(opts = {}) ⇒ Array<(ReviewListResponse, Integer, Hash)>

List reviews Cursor-paginated guest + host review stream for the workspace. Backed by main vanio&#39;s unified &#x60;reviews&#x60; table (populated by per-channel backfill crons), so this surface returns the complete cross-channel history — separate from &#x60;/v1/channels/airbnb/reviews&#x60; which hits Airbnb live. Filters: &#x60;platform&#x60; (&#x60;airbnb&#x60;|&#x60;booking&#x60;|&#x60;vrbo&#x60;), &#x60;listing_id&#x60; (internal Repull listing id), &#x60;rating_min&#x60; / &#x60;rating_max&#x60; (inclusive bounds, 0..5), &#x60;status&#x60; (&#x60;responded&#x60;|&#x60;unanswered&#x60;|&#x60;all&#x60;), &#x60;reviewer_role&#x60; (&#x60;guest&#x60; (default) | &#x60;host&#x60; | &#x60;all&#x60;).

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;.

  • :limit (Integer) — default: default to 20
  • :platform (String)
  • :listing_id (Integer)

    Restrict to one internal Repull listing.

  • :rating_min (Float)
  • :rating_max (Float)
  • :status (String)

    &#x60;responded&#x60; — host has replied. &#x60;unanswered&#x60; — host has not replied. &#x60;all&#x60; — no filter.

  • :reviewer_role (String)

    &#x60;guest&#x60; (default) — reviews written by guests about the host/property. &#x60;host&#x60; — reviews written by the host about guests. &#x60;all&#x60; — both. (default to ‘guest’)

Returns:

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

    ReviewListResponse data, response status code and response headers



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
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
# File 'lib/repull/api/reviews_api.rb', line 119

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

  allowable_values = ["airbnb", "booking", "vrbo"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'rating_min'].nil? && opts[:'rating_min'] > 5
    fail ArgumentError, 'invalid value for "opts[:"rating_min"]" when calling ReviewsApi.list_reviews, must be smaller than or equal to 5.'
  end

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

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

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

  allowable_values = ["responded", "unanswered", "all"]
  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
  allowable_values = ["guest", "host", "all"]
  if @api_client.config.client_side_validation && opts[:'reviewer_role'] && !allowable_values.include?(opts[:'reviewer_role'])
    fail ArgumentError, "invalid value for \"reviewer_role\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/reviews'

  # 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[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'listingId'] = opts[:'listing_id'] if !opts[:'listing_id'].nil?
  query_params[:'rating_min'] = opts[:'rating_min'] if !opts[:'rating_min'].nil?
  query_params[:'rating_max'] = opts[:'rating_max'] if !opts[:'rating_max'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'reviewerRole'] = opts[:'reviewer_role'] if !opts[:'reviewer_role'].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] || 'ReviewListResponse'

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

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