Class: Zernio::ReviewsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/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/zernio-sdk/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/zernio-sdk/api/reviews_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_inbox_review_reply(review_id, delete_inbox_review_reply_request, opts = {}) ⇒ DeleteInboxReviewReply200Response

Delete review reply Delete a reply to a review (Google Business only). Requires accountId in request body.

Parameters:

Returns:



28
29
30
31
# File 'lib/zernio-sdk/api/reviews_api.rb', line 28

def delete_inbox_review_reply(review_id, delete_inbox_review_reply_request, opts = {})
  data, _status_code, _headers = delete_inbox_review_reply_with_http_info(review_id, delete_inbox_review_reply_request, opts)
  data
end

#delete_inbox_review_reply_with_http_info(review_id, delete_inbox_review_reply_request, opts = {}) ⇒ Array<(DeleteInboxReviewReply200Response, Integer, Hash)>

Delete review reply Delete a reply to a review (Google Business only). Requires accountId in request body.

Parameters:

Returns:



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
87
88
89
90
91
92
93
94
# File 'lib/zernio-sdk/api/reviews_api.rb', line 39

def delete_inbox_review_reply_with_http_info(review_id, delete_inbox_review_reply_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.delete_inbox_review_reply ...'
  end
  # verify the required parameter 'review_id' is set
  if @api_client.config.client_side_validation && review_id.nil?
    fail ArgumentError, "Missing the required parameter 'review_id' when calling ReviewsApi.delete_inbox_review_reply"
  end
  # verify the required parameter 'delete_inbox_review_reply_request' is set
  if @api_client.config.client_side_validation && delete_inbox_review_reply_request.nil?
    fail ArgumentError, "Missing the required parameter 'delete_inbox_review_reply_request' when calling ReviewsApi.delete_inbox_review_reply"
  end
  # resource path
  local_var_path = '/v1/inbox/reviews/{reviewId}/reply'.sub('{' + 'reviewId' + '}', CGI.escape(review_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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(delete_inbox_review_reply_request)

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

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

  new_options = opts.merge(
    :operation => :"ReviewsApi.delete_inbox_review_reply",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#delete_inbox_review_reply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_inbox_reviews(opts = {}) ⇒ ListInboxReviews200Response

List reviews Fetch reviews from all connected Facebook Pages and Google Business accounts. Aggregates data with filtering and sorting options. Supported platforms: Facebook, Google Business.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)
  • :platform (String)
  • :min_rating (Integer)
  • :max_rating (Integer)
  • :has_reply (Boolean)

    Filter by reply status

  • :sort_by (String) — default: default to 'date'
  • :sort_order (String) — default: default to 'desc'
  • :limit (Integer) — default: default to 25
  • :cursor (String)
  • :account_id (String)

    Filter by specific social account ID

Returns:



110
111
112
113
# File 'lib/zernio-sdk/api/reviews_api.rb', line 110

def list_inbox_reviews(opts = {})
  data, _status_code, _headers = list_inbox_reviews_with_http_info(opts)
  data
end

#list_inbox_reviews_with_http_info(opts = {}) ⇒ Array<(ListInboxReviews200Response, Integer, Hash)>

List reviews Fetch reviews from all connected Facebook Pages and Google Business accounts. Aggregates data with filtering and sorting options. Supported platforms: Facebook, Google Business.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)
  • :platform (String)
  • :min_rating (Integer)
  • :max_rating (Integer)
  • :has_reply (Boolean)

    Filter by reply status

  • :sort_by (String) — default: default to 'date'
  • :sort_order (String) — default: default to 'desc'
  • :limit (Integer) — default: default to 25
  • :cursor (String)
  • :account_id (String)

    Filter by specific social account ID

Returns:

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

    ListInboxReviews200Response data, response status code and response headers



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
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/zernio-sdk/api/reviews_api.rb', line 129

def list_inbox_reviews_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.list_inbox_reviews ...'
  end
  allowable_values = ["facebook", "googlebusiness"]
  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[:'min_rating'].nil? && opts[:'min_rating'] > 5
    fail ArgumentError, 'invalid value for "opts[:"min_rating"]" when calling ReviewsApi.list_inbox_reviews, must be smaller than or equal to 5.'
  end

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

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

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

  allowable_values = ["date", "rating"]
  if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
    fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
    fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ReviewsApi.list_inbox_reviews, must be smaller than or equal to 50.'
  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_inbox_reviews, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/inbox/reviews'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'minRating'] = opts[:'min_rating'] if !opts[:'min_rating'].nil?
  query_params[:'maxRating'] = opts[:'max_rating'] if !opts[:'max_rating'].nil?
  query_params[:'hasReply'] = opts[:'has_reply'] if !opts[:'has_reply'].nil?
  query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_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']

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

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

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

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

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

#reply_to_inbox_review(review_id, reply_to_inbox_review_request, opts = {}) ⇒ ReplyToInboxReview200Response

Reply to review Post a reply to a review. Requires accountId in request body.

Parameters:

  • review_id (String)

    Review ID (URL-encoded for Google Business)

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

    the optional parameters

Returns:



225
226
227
228
# File 'lib/zernio-sdk/api/reviews_api.rb', line 225

def reply_to_inbox_review(review_id, reply_to_inbox_review_request, opts = {})
  data, _status_code, _headers = reply_to_inbox_review_with_http_info(review_id, reply_to_inbox_review_request, opts)
  data
end

#reply_to_inbox_review_with_http_info(review_id, reply_to_inbox_review_request, opts = {}) ⇒ Array<(ReplyToInboxReview200Response, Integer, Hash)>

Reply to review Post a reply to a review. Requires accountId in request body.

Parameters:

  • review_id (String)

    Review ID (URL-encoded for Google Business)

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

    the optional parameters

Returns:



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/zernio-sdk/api/reviews_api.rb', line 236

def reply_to_inbox_review_with_http_info(review_id, reply_to_inbox_review_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.reply_to_inbox_review ...'
  end
  # verify the required parameter 'review_id' is set
  if @api_client.config.client_side_validation && review_id.nil?
    fail ArgumentError, "Missing the required parameter 'review_id' when calling ReviewsApi.reply_to_inbox_review"
  end
  # verify the required parameter 'reply_to_inbox_review_request' is set
  if @api_client.config.client_side_validation && reply_to_inbox_review_request.nil?
    fail ArgumentError, "Missing the required parameter 'reply_to_inbox_review_request' when calling ReviewsApi.reply_to_inbox_review"
  end
  # resource path
  local_var_path = '/v1/inbox/reviews/{reviewId}/reply'.sub('{' + 'reviewId' + '}', CGI.escape(review_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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_to_inbox_review_request)

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

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

  new_options = opts.merge(
    :operation => :"ReviewsApi.reply_to_inbox_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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#reply_to_inbox_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end