Class: Quandoo::ReviewsApi

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

def api_client
  @api_client
end

Instance Method Details

#create_review1(body, opts = {}) ⇒ ChangedReviewDto

Create a review for a reservation This resource manages the creation of reviews for a particular agent and a reservation. Reviews must have a description, rating and a reservation public identifier. The agent must be the one that created the reservation, otherwise it is forbidden. ####Request: The request needs to have 3 parameters for review reviewId, description and rating. * reservationId: Public ID of the reservation where to add a review. Required. * description: Text content of the review to be set. Optional. A review requires a minimum of a rating. * rating: Integer value from 1 to 6 with the new rating given. Required. ####Response: The response is a review object containing information about the review. * reviewId: The Id of the created review. * status: Status of the created review. Can be ‘PENDING’, ‘PUBLISHED’ or ‘WITHHELD’. After a successful creation, ‘PENDING’ is returned. * links: A series of links where to get details of the created review; Example curl: “‘ curl -H "Content-Type: application/json" -X POST -d ’ { "reservationId": "07f53b36-3f48-11e5-a151-feff819cdc9f", "description": "Some description of the review", "rating": 1 } “‘ Example response: “` { "reviewId": "01a53b36-3f48-11e5-a151-feff819cdc9f", "status": "PENDING", "links": [{ "href": "localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f", "method": "GET", "rel": "get-review" }] } “`

Parameters:

  • body

    Review for this reservation

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/quandoo/api/reviews_api.rb', line 27

def create_review1(body, opts = {})
  data, _status_code, _headers = create_review1_with_http_info(body, opts)
  data
end

#create_review1_with_http_info(body, opts = {}) ⇒ Array<(ChangedReviewDto, Fixnum, Hash)>

Create a review for a reservation This resource manages the creation of reviews for a particular agent and a reservation. Reviews must have a description, rating and a reservation public identifier. The agent must be the one that created the reservation, otherwise it is forbidden. ####Request: The request needs to have 3 parameters for review reviewId, description and rating. * reservationId: Public ID of the reservation where to add a review. Required. * description: Text content of the review to be set. Optional. A review requires a minimum of a rating. * rating: Integer value from 1 to 6 with the new rating given. Required. ####Response: The response is a review object containing information about the review. * reviewId: The Id of the created review. * status: Status of the created review. Can be &#39;PENDING&#39;, &#39;PUBLISHED&#39; or &#39;WITHHELD&#39;. After a successful creation, &#39;PENDING&#39; is returned. * links: A series of links where to get details of the created review; Example curl: &#x60;&#x60;&#x60; curl -H &quot;Content-Type: application/json&quot; -X POST -d &#39; { &quot;reservationId&quot;: &quot;07f53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;description&quot;: &quot;Some description of the review&quot;, &quot;rating&quot;: 1 } &#x60;&#x60;&#x60; Example response: &#x60;&#x60;&#x60; { &quot;reviewId&quot;: &quot;01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;status&quot;: &quot;PENDING&quot;, &quot;links&quot;: [{ &quot;href&quot;: &quot;localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;method&quot;: &quot;GET&quot;, &quot;rel&quot;: &quot;get-review&quot; }] } &#x60;&#x60;&#x60;

Parameters:

  • body

    Review for this reservation

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

    the optional parameters

Returns:

  • (Array<(ChangedReviewDto, Fixnum, Hash)>)

    ChangedReviewDto data, response status code and response headers



37
38
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
# File 'lib/quandoo/api/reviews_api.rb', line 37

def create_review1_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.create_review1 ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling ReviewsApi.create_review1"
  end
  # resource path
  local_var_path = '/v1/reviews'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['API_TOKEN']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ChangedReviewDto')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#create_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_review1(review_id, opts = {}) ⇒ GetReviewDto

Get details for a specific review This resource return details from reviews upon request. The result obtained depends on whether the agent is the owner of the reservation that owns the review or not. * If the user owns the reservation of the requested review, a detailed review is returned with all the information shown below. * If the user does not own the reservation of the requested review, a simplified review is returned with only the values marked below. * If the user does not own the reservation of the requested review AND the review is in a ‘WITHHELD’ status, an empty review is returned. ####Request: The request needs 1 path parameter, the review ID to get details from. * reviewId: ID of the review to get the details from. Required. ####Response: The response is a user review object containing information about the review depending on whether the agent used is the owner of the review or not. The different outcomes are detailed if the agent owns the review or simplified if not. * reviewId: review UUID. Same as the one used in the request. * rating: rating associated to this review. * description: description of the review. * status: current review status. Possible values are ‘PENDING’, ‘WITHHELD’, ‘PUBLISHED’. * merchantId: merchant id associated to this review. **Only in the detailed view**. * customerId: customer id associated to this review. **DEPPRECATED, NOT USED**. * publicCustomerId: public customer id associated to this review. **Only in the detailed view**. * customerFirstName: review associated customer first name. **Only in the detailed view**. * customerLastName: first character of the customer last name. **Only in the detailed view**. * customerProfileImage: customer profile image URL. **Only in the detailed view**. * locale: locale associated to the review. **Only in the detailed view**. Example curl: “‘ curl https://host/vX/reviews/07f53b36-3f48-11e5-a151-feff819cdc9f “` Example response: “` { "reviewId": "01a53b36-3f48-11e5-a151-feff819cdc9f", "status": "PUBLISHED", "description": "Description of the review", "rating": 3 } “`

Parameters:

  • review_id

    Review reviewId (UUID) to get details from

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

    the optional parameters

Returns:



81
82
83
84
# File 'lib/quandoo/api/reviews_api.rb', line 81

def get_review1(review_id, opts = {})
  data, _status_code, _headers = get_review1_with_http_info(review_id, opts)
  data
end

#get_review1_with_http_info(review_id, opts = {}) ⇒ Array<(GetReviewDto, Fixnum, Hash)>

Get details for a specific review This resource return details from reviews upon request. The result obtained depends on whether the agent is the owner of the reservation that owns the review or not. * If the user owns the reservation of the requested review, a detailed review is returned with all the information shown below. * If the user does not own the reservation of the requested review, a simplified review is returned with only the values marked below. * If the user does not own the reservation of the requested review AND the review is in a &#39;WITHHELD&#39; status, an empty review is returned. ####Request: The request needs 1 path parameter, the review ID to get details from. * reviewId: ID of the review to get the details from. Required. ####Response: The response is a user review object containing information about the review depending on whether the agent used is the owner of the review or not. The different outcomes are detailed if the agent owns the review or simplified if not. * reviewId: review UUID. Same as the one used in the request. * rating: rating associated to this review. * description: description of the review. * status: current review status. Possible values are &#39;PENDING&#39;, &#39;WITHHELD&#39;, &#39;PUBLISHED&#39;. * merchantId: merchant id associated to this review. **Only in the detailed view**. * customerId: customer id associated to this review. **DEPPRECATED, NOT USED**. * publicCustomerId: public customer id associated to this review. **Only in the detailed view**. * customerFirstName: review associated customer first name. **Only in the detailed view**. * customerLastName: first character of the customer last name. **Only in the detailed view**. * customerProfileImage: customer profile image URL. **Only in the detailed view**. * locale: locale associated to the review. **Only in the detailed view**. Example curl: &#x60;&#x60;&#x60; curl https://host/vX/reviews/07f53b36-3f48-11e5-a151-feff819cdc9f &#x60;&#x60;&#x60; Example response: &#x60;&#x60;&#x60; { &quot;reviewId&quot;: &quot;01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;status&quot;: &quot;PUBLISHED&quot;, &quot;description&quot;: &quot;Description of the review&quot;, &quot;rating&quot;: 3 } &#x60;&#x60;&#x60;

Parameters:

  • review_id

    Review reviewId (UUID) to get details from

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

    the optional parameters

Returns:

  • (Array<(GetReviewDto, Fixnum, Hash)>)

    GetReviewDto data, response status code and response headers



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/quandoo/api/reviews_api.rb', line 91

def get_review1_with_http_info(review_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.get_review1 ...'
  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.get_review1"
  end
  # resource path
  local_var_path = '/v1/reviews/{reviewId}'.sub('{' + 'reviewId' + '}', review_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_TOKEN']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetReviewDto')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#get_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_reviews2(opts = {}) ⇒ GetReviewsDto

Get information from reviews in a list This resource return a list of reviews. The result obtained depends on the different query parameters provided. It is able to return three different results: * **Reviews associated to an agent:** if neither ‘merchantId’ nor ‘reservationId’ query parameters are provided, then the available reviews for the current agent are returned. * **Reviews associated to a merchant:** if the parameter ‘merchantId’ is provided, all the reviews for the given merchant and agent are provided. The agent is the one associated with the reservations. * **Reviews associated to a reservation:** if the parameter ‘reservationId’ is provided, all the reviews for the given reservation and agent are provided. The agent is the one associated with the reservation. NOTE: For the second and third cases, the current agent must be the owner of the reservations used to get the reviews. In the specific case of the search by the merchants, the current agent id is the one realated to the reservations associated to the specified merchant’s reviews. ####Request: The request needs 4 optional query parameters. Pagination is controlled by the usage of the ‘limit’ and ‘offset’ parameters. * limit: maximum number of results to be returned. Value must be between 1 and 10. Defaults to 10 when unset, malformed or outside bounds. Ignored when ‘reservationId’ is enabled. * offset: sets the starting element to be returned. Defaults to 0 when unset or malformed. Ignored when ‘reservationId’ is enabled. * reservationId: Public ID of the reservation from which to get the reviews. Cannot be used in combination with ‘merchantId’. Can be null. Does not consider ‘limit’ and/or ‘offset’. * merchantId: ID of the merchant from wich to get the reviews. Cannot be used in combination with ‘reservationId’. Can be null. ####Response: The response is a user review object containing a list of user reviews. * size: the number of reviews retrieved in this request. Can be any positive value between 0 and 10 (the maximum value for limit); * offset: echoes the offset value used in the request. Returns 0 in case ‘reservationId’ is used. * limit: echoes the limit value used in the request. Returns 0 in case ‘reservationId’ is used. * reviews: list of reviews retrieved, each review containing the following properties: * reviewId: review UUID. Same as the one used in the request. * rating: rating associated to this review. * description: description of the review. * status: current review status. Possible values are ‘PENDING’, ‘WITHHELD’, ‘PUBLISHED’. * merchantId: merchant id associated to this review. **Only in the detailed view**. * customerId: customer id associated to this review. **DEPPRECATED, NOT USED**. * publicCustomerId: public customer id associated to this review. **Only in the detailed view**. * customerFirstName: review associated customer first name. **Only in the detailed view**. * customerLastName: first character of the customer last name. **Only in the detailed view**. * customerProfileImage: customer profile image URL. **Only in the detailed view**. * locale: locale associated to the review. **Only in the detailed view**. Example curl: “‘ curl https://host/vX/reviews?merchantId=5124 “` Example response: “` { "reviews": [{ "reviewId": "e94c5f9b-e61f-486a-bfa7-48abb1e42f93", "merchantId": 5124, "publicCustomerId": "a10fbb9a-df04-407c-9568-2e79bd620b41", "customerFirstName": "Perico", "customerLastName": "d", "customerProfileImage": "test.bla", "rating": 6, "description": "Description 8", "status": "PUBLISHED", "locale": "de_DE" }, { "reviewId": "65472403-7968-4ccf-b389-fe7e6e70ee27", "merchantId": 5124, "publicCustomerId": "a10fbb9a-df04-407c-9568-2e79bd620b41", "customerFirstName": "Perico", "customerLastName": "d", "customerProfileImage": "test.bla", "rating": 6, "description": "Description 9", "status": "PUBLISHED", "locale": "de_DE" } ], "size": 2, "offset": 0, "limit": 10 } “`

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :merchant_id (Integer)

    MerchantId to get the reviews from. Cannot be used in combination with &#39;reservationId&#39;

  • :reservation_id (String)

    Public reservation id to get the reviews from. Cannot be used in combination with &#39;merchantId&#39;. When set, &#39;offset&#39; and &#39;limit&#39; are ignored. All reviews for a reservation are returned.

  • :offset (Integer)

    Skip first n reviews (default to 0)

  • :limit (Integer)

    Max number to retrieve (default to 10)

Returns:



136
137
138
139
# File 'lib/quandoo/api/reviews_api.rb', line 136

def get_reviews2(opts = {})
  data, _status_code, _headers = get_reviews2_with_http_info(opts)
  data
end

#get_reviews2_with_http_info(opts = {}) ⇒ Array<(GetReviewsDto, Fixnum, Hash)>

Get information from reviews in a list This resource return a list of reviews. The result obtained depends on the different query parameters provided. It is able to return three different results: * **Reviews associated to an agent:** if neither &#39;merchantId&#39; nor &#39;reservationId&#39; query parameters are provided, then the available reviews for the current agent are returned. * **Reviews associated to a merchant:** if the parameter &#39;merchantId&#39; is provided, all the reviews for the given merchant and agent are provided. The agent is the one associated with the reservations. * **Reviews associated to a reservation:** if the parameter &#39;reservationId&#39; is provided, all the reviews for the given reservation and agent are provided. The agent is the one associated with the reservation. NOTE: For the second and third cases, the current agent must be the owner of the reservations used to get the reviews. In the specific case of the search by the merchants, the current agent id is the one realated to the reservations associated to the specified merchant&#39;s reviews. ####Request: The request needs 4 optional query parameters. Pagination is controlled by the usage of the &#39;limit&#39; and &#39;offset&#39; parameters. * limit: maximum number of results to be returned. Value must be between 1 and 10. Defaults to 10 when unset, malformed or outside bounds. Ignored when &#39;reservationId&#39; is enabled. * offset: sets the starting element to be returned. Defaults to 0 when unset or malformed. Ignored when &#39;reservationId&#39; is enabled. * reservationId: Public ID of the reservation from which to get the reviews. Cannot be used in combination with &#39;merchantId&#39;. Can be null. Does not consider &#39;limit&#39; and/or &#39;offset&#39;. * merchantId: ID of the merchant from wich to get the reviews. Cannot be used in combination with &#39;reservationId&#39;. Can be null. ####Response: The response is a user review object containing a list of user reviews. * size: the number of reviews retrieved in this request. Can be any positive value between 0 and 10 (the maximum value for limit); * offset: echoes the offset value used in the request. Returns 0 in case &#39;reservationId&#39; is used. * limit: echoes the limit value used in the request. Returns 0 in case &#39;reservationId&#39; is used. * reviews: list of reviews retrieved, each review containing the following properties: * reviewId: review UUID. Same as the one used in the request. * rating: rating associated to this review. * description: description of the review. * status: current review status. Possible values are &#39;PENDING&#39;, &#39;WITHHELD&#39;, &#39;PUBLISHED&#39;. * merchantId: merchant id associated to this review. **Only in the detailed view**. * customerId: customer id associated to this review. **DEPPRECATED, NOT USED**. * publicCustomerId: public customer id associated to this review. **Only in the detailed view**. * customerFirstName: review associated customer first name. **Only in the detailed view**. * customerLastName: first character of the customer last name. **Only in the detailed view**. * customerProfileImage: customer profile image URL. **Only in the detailed view**. * locale: locale associated to the review. **Only in the detailed view**. Example curl: &#x60;&#x60;&#x60; curl https://host/vX/reviews?merchantId&#x3D;5124 &#x60;&#x60;&#x60; Example response: &#x60;&#x60;&#x60; { &quot;reviews&quot;: [{ &quot;reviewId&quot;: &quot;e94c5f9b-e61f-486a-bfa7-48abb1e42f93&quot;, &quot;merchantId&quot;: 5124, &quot;publicCustomerId&quot;: &quot;a10fbb9a-df04-407c-9568-2e79bd620b41&quot;, &quot;customerFirstName&quot;: &quot;Perico&quot;, &quot;customerLastName&quot;: &quot;d&quot;, &quot;customerProfileImage&quot;: &quot;test.bla&quot;, &quot;rating&quot;: 6, &quot;description&quot;: &quot;Description 8&quot;, &quot;status&quot;: &quot;PUBLISHED&quot;, &quot;locale&quot;: &quot;de_DE&quot; }, { &quot;reviewId&quot;: &quot;65472403-7968-4ccf-b389-fe7e6e70ee27&quot;, &quot;merchantId&quot;: 5124, &quot;publicCustomerId&quot;: &quot;a10fbb9a-df04-407c-9568-2e79bd620b41&quot;, &quot;customerFirstName&quot;: &quot;Perico&quot;, &quot;customerLastName&quot;: &quot;d&quot;, &quot;customerProfileImage&quot;: &quot;test.bla&quot;, &quot;rating&quot;: 6, &quot;description&quot;: &quot;Description 9&quot;, &quot;status&quot;: &quot;PUBLISHED&quot;, &quot;locale&quot;: &quot;de_DE&quot; } ], &quot;size&quot;: 2, &quot;offset&quot;: 0, &quot;limit&quot;: 10 } &#x60;&#x60;&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :merchant_id (Integer)

    MerchantId to get the reviews from. Cannot be used in combination with &#39;reservationId&#39;

  • :reservation_id (String)

    Public reservation id to get the reviews from. Cannot be used in combination with &#39;merchantId&#39;. When set, &#39;offset&#39; and &#39;limit&#39; are ignored. All reviews for a reservation are returned.

  • :offset (Integer)

    Skip first n reviews

  • :limit (Integer)

    Max number to retrieve

Returns:

  • (Array<(GetReviewsDto, Fixnum, Hash)>)

    GetReviewsDto data, response status code and response headers



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

def get_reviews2_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.get_reviews2 ...'
  end
  # resource path
  local_var_path = '/v1/reviews'

  # query parameters
  query_params = {}
  query_params[:'merchantId'] = opts[:'merchant_id'] if !opts[:'merchant_id'].nil?
  query_params[:'reservationId'] = opts[:'reservation_id'] if !opts[:'reservation_id'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API_TOKEN']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetReviewsDto')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#get_reviews2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_review1(body, opts = {}) ⇒ ChangedReviewDto

Updated a review This resource manages the update of reviews for a given review ID. Description and rating can be updated on a review. The agent must be the one that owns the reservation associated to the review to modify, otherwise a forbidden response is returned. NOTE: Reviews in state ‘PUBLISHED’ or ‘WITHHELD’ cannot be updated. Only those in status ‘PENDING’ are allowed to be updated. ####Request: The request needs to have 3 parameters for reservation reviewId (public reviewId), description and rating. * reviewId: Id of the review. Required. * description: Text content of the review. If not set (null value) it won’t be considered for update. * rating: Integer value from 1 to 6 with the rating given. If not set (null value) it won’t be considered for update. In case both description and rating are set to null, nothing happens to the review: it is not updated and its state remains. ####Response: The response is a review object containing information about the review. * reviewId: The Id of the updated review. * status: Status of the updated review. Can be ‘PENDING’, ‘PUBLISHED’ or ‘WITHHELD’. Upon a successful update, the status ‘PENDING’ is returned. * links: A series of links where to get details of the updated review. Example curl: “‘ curl -H "Content-Type: application/json" -X POST -d ’ { "reviewId": "01a53b36-3f48-11e5-a151-feff819cdc9f", "description": "Some updated description for the review", "rating": 2 } “‘ Example response: “` { "reviewId": "01a53b36-3f48-11e5-a151-feff819cdc9f", "status": "PENDING", "links": [{ "href": "localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f", "method": "GET", "rel": "get-review" }] } “`

Parameters:

  • body

    Review for this reservation

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

    the optional parameters

Returns:



191
192
193
194
# File 'lib/quandoo/api/reviews_api.rb', line 191

def update_review1(body, opts = {})
  data, _status_code, _headers = update_review1_with_http_info(body, opts)
  data
end

#update_review1_with_http_info(body, opts = {}) ⇒ Array<(ChangedReviewDto, Fixnum, Hash)>

Updated a review This resource manages the update of reviews for a given review ID. Description and rating can be updated on a review. The agent must be the one that owns the reservation associated to the review to modify, otherwise a forbidden response is returned. NOTE: Reviews in state &#39;PUBLISHED&#39; or &#39;WITHHELD&#39; cannot be updated. Only those in status &#39;PENDING&#39; are allowed to be updated. ####Request: The request needs to have 3 parameters for reservation reviewId (public reviewId), description and rating. * reviewId: Id of the review. Required. * description: Text content of the review. If not set (null value) it won&#39;t be considered for update. * rating: Integer value from 1 to 6 with the rating given. If not set (null value) it won&#39;t be considered for update. In case both description and rating are set to null, nothing happens to the review: it is not updated and its state remains. ####Response: The response is a review object containing information about the review. * reviewId: The Id of the updated review. * status: Status of the updated review. Can be &#39;PENDING&#39;, &#39;PUBLISHED&#39; or &#39;WITHHELD&#39;. Upon a successful update, the status &#39;PENDING&#39; is returned. * links: A series of links where to get details of the updated review. Example curl: &#x60;&#x60;&#x60; curl -H &quot;Content-Type: application/json&quot; -X POST -d &#39; { &quot;reviewId&quot;: &quot;01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;description&quot;: &quot;Some updated description for the review&quot;, &quot;rating&quot;: 2 } &#x60;&#x60;&#x60; Example response: &#x60;&#x60;&#x60; { &quot;reviewId&quot;: &quot;01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;status&quot;: &quot;PENDING&quot;, &quot;links&quot;: [{ &quot;href&quot;: &quot;localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f&quot;, &quot;method&quot;: &quot;GET&quot;, &quot;rel&quot;: &quot;get-review&quot; }] } &#x60;&#x60;&#x60;

Parameters:

  • body

    Review for this reservation

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

    the optional parameters

Returns:

  • (Array<(ChangedReviewDto, Fixnum, Hash)>)

    ChangedReviewDto data, response status code and response headers



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/quandoo/api/reviews_api.rb', line 201

def update_review1_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReviewsApi.update_review1 ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling ReviewsApi.update_review1"
  end
  # resource path
  local_var_path = '/v1/reviews'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['API_TOKEN']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ChangedReviewDto')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReviewsApi#update_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end