quandoo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +197 -0
  4. data/Rakefile +8 -0
  5. data/config.json +8 -0
  6. data/docs/AgentTracking.md +8 -0
  7. data/docs/AreaDto.md +10 -0
  8. data/docs/AvailabilitiesApi.md +132 -0
  9. data/docs/ChainDto.md +9 -0
  10. data/docs/ChangedReviewDto.md +10 -0
  11. data/docs/CoordinatesDto.md +9 -0
  12. data/docs/CreateReviewDto.md +10 -0
  13. data/docs/CreatedMasterCustomer.md +8 -0
  14. data/docs/CreatedReservation.md +11 -0
  15. data/docs/CreatedReservationData.md +10 -0
  16. data/docs/CreatedReservationEnquiry.md +8 -0
  17. data/docs/CreatedReservationEnquiryData.md +10 -0
  18. data/docs/CustomerDataList.md +10 -0
  19. data/docs/CustomerDto.md +10 -0
  20. data/docs/CustomerResponse.md +17 -0
  21. data/docs/CustomerReviewData.md +11 -0
  22. data/docs/CustomerStatisticsData.md +10 -0
  23. data/docs/CustomersApi.md +183 -0
  24. data/docs/DealData.md +10 -0
  25. data/docs/DocumentDto.md +11 -0
  26. data/docs/ErrorResponse.md +9 -0
  27. data/docs/GetReservationEnquiryData.md +14 -0
  28. data/docs/GetReviewDto.md +14 -0
  29. data/docs/GetReviewsDto.md +11 -0
  30. data/docs/ImageDto.md +8 -0
  31. data/docs/LinkRelationDto.md +10 -0
  32. data/docs/LocationDto.md +9 -0
  33. data/docs/MarketingSettingDto.md +9 -0
  34. data/docs/MenusApi.md +300 -0
  35. data/docs/MerchantAddressDto.md +12 -0
  36. data/docs/MerchantAvailabilityDaysDto.md +9 -0
  37. data/docs/MerchantAvailabilityDto.md +11 -0
  38. data/docs/MerchantAvailabilityDtoList.md +10 -0
  39. data/docs/MerchantCustomer.md +15 -0
  40. data/docs/MerchantCustomerData.md +21 -0
  41. data/docs/MerchantDetailsDto.md +24 -0
  42. data/docs/MerchantDetailsDtoList.md +11 -0
  43. data/docs/MerchantMenuCategoryDto.md +10 -0
  44. data/docs/MerchantMenuDto.md +13 -0
  45. data/docs/MerchantMenuItemDto.md +11 -0
  46. data/docs/MerchantMenusDto.md +8 -0
  47. data/docs/MerchantReservation.md +18 -0
  48. data/docs/MerchantReservationData.md +10 -0
  49. data/docs/MerchantReservationEnquiry.md +13 -0
  50. data/docs/MerchantReservationEnquiryData.md +10 -0
  51. data/docs/MerchantReservationSettingsDto.md +18 -0
  52. data/docs/MerchantSubscription.md +8 -0
  53. data/docs/MerchantVaultSettingsDto.md +11 -0
  54. data/docs/MerchantWithRecommendationsDto.md +10 -0
  55. data/docs/MerchantsApi.md +334 -0
  56. data/docs/OpeningTimesDto.md +8 -0
  57. data/docs/ReservationData.md +18 -0
  58. data/docs/ReservationDataList.md +8 -0
  59. data/docs/ReservationDetails.md +11 -0
  60. data/docs/ReservationEnquiriesApi.md +230 -0
  61. data/docs/ReservationEnquiryMessageData.md +10 -0
  62. data/docs/ReservationEnquiryMessageList.md +8 -0
  63. data/docs/ReservationMenuData.md +8 -0
  64. data/docs/ReservationMenuItemData.md +12 -0
  65. data/docs/ReservationSettingsApi.md +56 -0
  66. data/docs/ReservationsApi.md +168 -0
  67. data/docs/RestCookie.md +9 -0
  68. data/docs/ReviewDto.md +12 -0
  69. data/docs/ReviewDtoList.md +11 -0
  70. data/docs/ReviewsApi.md +235 -0
  71. data/docs/StandardOpeningTimesDto.md +7 -0
  72. data/docs/StatusApi.md +90 -0
  73. data/docs/TagGroupDto.md +9 -0
  74. data/docs/Tracking.md +9 -0
  75. data/docs/TranslatedTagDto.md +9 -0
  76. data/docs/UpdateReservationData.md +8 -0
  77. data/docs/UpdateReservationEnquiryData.md +8 -0
  78. data/docs/UpdateReviewDto.md +10 -0
  79. data/docs/ValidationsApi.md +59 -0
  80. data/git_push.sh +55 -0
  81. data/lib/quandoo.rb +113 -0
  82. data/lib/quandoo/api/availabilities_api.rb +171 -0
  83. data/lib/quandoo/api/customers_api.rb +185 -0
  84. data/lib/quandoo/api/menus_api.rb +301 -0
  85. data/lib/quandoo/api/merchants_api.rb +357 -0
  86. data/lib/quandoo/api/reservation_enquiries_api.rb +232 -0
  87. data/lib/quandoo/api/reservation_settings_api.rb +73 -0
  88. data/lib/quandoo/api/reservations_api.rb +178 -0
  89. data/lib/quandoo/api/reviews_api.rb +241 -0
  90. data/lib/quandoo/api/status_api.rb +111 -0
  91. data/lib/quandoo/api/validations_api.rb +76 -0
  92. data/lib/quandoo/api_client.rb +389 -0
  93. data/lib/quandoo/api_error.rb +38 -0
  94. data/lib/quandoo/configuration.rb +216 -0
  95. data/lib/quandoo/models/agent_tracking.rb +189 -0
  96. data/lib/quandoo/models/area_dto.rb +204 -0
  97. data/lib/quandoo/models/chain_dto.rb +192 -0
  98. data/lib/quandoo/models/changed_review_dto.rb +250 -0
  99. data/lib/quandoo/models/coordinates_dto.rb +192 -0
  100. data/lib/quandoo/models/create_review_dto.rb +214 -0
  101. data/lib/quandoo/models/created_master_customer.rb +189 -0
  102. data/lib/quandoo/models/created_reservation.rb +229 -0
  103. data/lib/quandoo/models/created_reservation_data.rb +221 -0
  104. data/lib/quandoo/models/created_reservation_enquiry.rb +189 -0
  105. data/lib/quandoo/models/created_reservation_enquiry_data.rb +221 -0
  106. data/lib/quandoo/models/customer_data_list.rb +203 -0
  107. data/lib/quandoo/models/customer_dto.rb +201 -0
  108. data/lib/quandoo/models/customer_response.rb +362 -0
  109. data/lib/quandoo/models/customer_review_data.rb +214 -0
  110. data/lib/quandoo/models/customer_statistics_data.rb +219 -0
  111. data/lib/quandoo/models/deal_data.rb +253 -0
  112. data/lib/quandoo/models/document_dto.rb +210 -0
  113. data/lib/quandoo/models/error_response.rb +226 -0
  114. data/lib/quandoo/models/get_reservation_enquiry_data.rb +249 -0
  115. data/lib/quandoo/models/get_review_dto.rb +288 -0
  116. data/lib/quandoo/models/get_reviews_dto.rb +216 -0
  117. data/lib/quandoo/models/image_dto.rb +183 -0
  118. data/lib/quandoo/models/link_relation_dto.rb +235 -0
  119. data/lib/quandoo/models/location_dto.rb +192 -0
  120. data/lib/quandoo/models/marketing_setting_dto.rb +238 -0
  121. data/lib/quandoo/models/merchant_address_dto.rb +219 -0
  122. data/lib/quandoo/models/merchant_availability_days_dto.rb +198 -0
  123. data/lib/quandoo/models/merchant_availability_dto.rb +226 -0
  124. data/lib/quandoo/models/merchant_availability_dto_list.rb +215 -0
  125. data/lib/quandoo/models/merchant_customer.rb +271 -0
  126. data/lib/quandoo/models/merchant_customer_data.rb +390 -0
  127. data/lib/quandoo/models/merchant_details_dto.rb +402 -0
  128. data/lib/quandoo/models/merchant_details_dto_list.rb +218 -0
  129. data/lib/quandoo/models/merchant_menu_category_dto.rb +216 -0
  130. data/lib/quandoo/models/merchant_menu_dto.rb +251 -0
  131. data/lib/quandoo/models/merchant_menu_item_dto.rb +224 -0
  132. data/lib/quandoo/models/merchant_menus_dto.rb +185 -0
  133. data/lib/quandoo/models/merchant_reservation.rb +301 -0
  134. data/lib/quandoo/models/merchant_reservation_data.rb +219 -0
  135. data/lib/quandoo/models/merchant_reservation_enquiry.rb +311 -0
  136. data/lib/quandoo/models/merchant_reservation_enquiry_data.rb +219 -0
  137. data/lib/quandoo/models/merchant_reservation_settings_dto.rb +290 -0
  138. data/lib/quandoo/models/merchant_subscription.rb +217 -0
  139. data/lib/quandoo/models/merchant_vault_settings_dto.rb +231 -0
  140. data/lib/quandoo/models/merchant_with_recommendations_dto.rb +248 -0
  141. data/lib/quandoo/models/opening_times_dto.rb +189 -0
  142. data/lib/quandoo/models/reservation_data.rb +331 -0
  143. data/lib/quandoo/models/reservation_data_list.rb +185 -0
  144. data/lib/quandoo/models/reservation_details.rb +229 -0
  145. data/lib/quandoo/models/reservation_enquiry_message_data.rb +241 -0
  146. data/lib/quandoo/models/reservation_enquiry_message_list.rb +185 -0
  147. data/lib/quandoo/models/reservation_menu_data.rb +190 -0
  148. data/lib/quandoo/models/reservation_menu_item_data.rb +219 -0
  149. data/lib/quandoo/models/rest_cookie.rb +194 -0
  150. data/lib/quandoo/models/review_dto.rb +238 -0
  151. data/lib/quandoo/models/review_dto_list.rb +218 -0
  152. data/lib/quandoo/models/standard_opening_times_dto.rb +174 -0
  153. data/lib/quandoo/models/tag_group_dto.rb +228 -0
  154. data/lib/quandoo/models/tracking.rb +199 -0
  155. data/lib/quandoo/models/translated_tag_dto.rb +192 -0
  156. data/lib/quandoo/models/update_reservation_data.rb +189 -0
  157. data/lib/quandoo/models/update_reservation_enquiry_data.rb +184 -0
  158. data/lib/quandoo/models/update_review_dto.rb +209 -0
  159. data/lib/quandoo/version.rb +15 -0
  160. data/quandoo.gemspec +45 -0
  161. data/spec/api/availabilities_api_spec.rb +69 -0
  162. data/spec/api/customers_api_spec.rb +75 -0
  163. data/spec/api/menus_api_spec.rb +100 -0
  164. data/spec/api/merchants_api_spec.rb +119 -0
  165. data/spec/api/reservation_enquiries_api_spec.rb +84 -0
  166. data/spec/api/reservation_settings_api_spec.rb +47 -0
  167. data/spec/api/reservations_api_spec.rb +72 -0
  168. data/spec/api/reviews_api_spec.rb +86 -0
  169. data/spec/api/status_api_spec.rb +57 -0
  170. data/spec/api/validations_api_spec.rb +48 -0
  171. data/spec/api_client_spec.rb +226 -0
  172. data/spec/configuration_spec.rb +42 -0
  173. data/spec/models/agent_tracking_spec.rb +41 -0
  174. data/spec/models/area_dto_spec.rb +53 -0
  175. data/spec/models/chain_dto_spec.rb +47 -0
  176. data/spec/models/changed_review_dto_spec.rb +57 -0
  177. data/spec/models/coordinates_dto_spec.rb +47 -0
  178. data/spec/models/create_review_dto_spec.rb +53 -0
  179. data/spec/models/created_master_customer_spec.rb +41 -0
  180. data/spec/models/created_reservation_data_spec.rb +53 -0
  181. data/spec/models/created_reservation_enquiry_data_spec.rb +53 -0
  182. data/spec/models/created_reservation_enquiry_spec.rb +41 -0
  183. data/spec/models/created_reservation_spec.rb +59 -0
  184. data/spec/models/customer_data_list_spec.rb +53 -0
  185. data/spec/models/customer_dto_spec.rb +53 -0
  186. data/spec/models/customer_response_spec.rb +99 -0
  187. data/spec/models/customer_review_data_spec.rb +59 -0
  188. data/spec/models/customer_statistics_data_spec.rb +53 -0
  189. data/spec/models/deal_data_spec.rb +57 -0
  190. data/spec/models/document_dto_spec.rb +59 -0
  191. data/spec/models/error_response_spec.rb +51 -0
  192. data/spec/models/get_reservation_enquiry_data_spec.rb +77 -0
  193. data/spec/models/get_review_dto_spec.rb +81 -0
  194. data/spec/models/get_reviews_dto_spec.rb +59 -0
  195. data/spec/models/image_dto_spec.rb +41 -0
  196. data/spec/models/link_relation_dto_spec.rb +57 -0
  197. data/spec/models/location_dto_spec.rb +47 -0
  198. data/spec/models/marketing_setting_dto_spec.rb +55 -0
  199. data/spec/models/merchant_address_dto_spec.rb +65 -0
  200. data/spec/models/merchant_availability_days_dto_spec.rb +47 -0
  201. data/spec/models/merchant_availability_dto_list_spec.rb +53 -0
  202. data/spec/models/merchant_availability_dto_spec.rb +59 -0
  203. data/spec/models/merchant_customer_data_spec.rb +119 -0
  204. data/spec/models/merchant_customer_spec.rb +83 -0
  205. data/spec/models/merchant_details_dto_list_spec.rb +59 -0
  206. data/spec/models/merchant_details_dto_spec.rb +137 -0
  207. data/spec/models/merchant_menu_category_dto_spec.rb +53 -0
  208. data/spec/models/merchant_menu_dto_spec.rb +71 -0
  209. data/spec/models/merchant_menu_item_dto_spec.rb +59 -0
  210. data/spec/models/merchant_menus_dto_spec.rb +41 -0
  211. data/spec/models/merchant_reservation_data_spec.rb +53 -0
  212. data/spec/models/merchant_reservation_enquiry_data_spec.rb +53 -0
  213. data/spec/models/merchant_reservation_enquiry_spec.rb +71 -0
  214. data/spec/models/merchant_reservation_settings_dto_spec.rb +101 -0
  215. data/spec/models/merchant_reservation_spec.rb +101 -0
  216. data/spec/models/merchant_subscription_spec.rb +45 -0
  217. data/spec/models/merchant_vault_settings_dto_spec.rb +59 -0
  218. data/spec/models/merchant_with_recommendations_dto_spec.rb +57 -0
  219. data/spec/models/opening_times_dto_spec.rb +41 -0
  220. data/spec/models/reservation_data_list_spec.rb +41 -0
  221. data/spec/models/reservation_data_spec.rb +101 -0
  222. data/spec/models/reservation_details_spec.rb +59 -0
  223. data/spec/models/reservation_enquiry_message_data_spec.rb +57 -0
  224. data/spec/models/reservation_enquiry_message_list_spec.rb +41 -0
  225. data/spec/models/reservation_menu_data_spec.rb +41 -0
  226. data/spec/models/reservation_menu_item_data_spec.rb +65 -0
  227. data/spec/models/rest_cookie_spec.rb +47 -0
  228. data/spec/models/review_dto_list_spec.rb +59 -0
  229. data/spec/models/review_dto_spec.rb +65 -0
  230. data/spec/models/standard_opening_times_dto_spec.rb +35 -0
  231. data/spec/models/tag_group_dto_spec.rb +51 -0
  232. data/spec/models/tracking_spec.rb +47 -0
  233. data/spec/models/translated_tag_dto_spec.rb +47 -0
  234. data/spec/models/update_reservation_data_spec.rb +41 -0
  235. data/spec/models/update_reservation_enquiry_data_spec.rb +41 -0
  236. data/spec/models/update_review_dto_spec.rb +53 -0
  237. data/spec/spec_helper.rb +111 -0
  238. metadata +538 -0
@@ -0,0 +1,241 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Quandoo
16
+ class ReviewsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a review for a reservation
23
+ # 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\": \"http://localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f\", \"method\": \"GET\", \"rel\": \"get-review\" }] } ```
24
+ # @param body Review for this reservation
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ChangedReviewDto]
27
+ def create_review1(body, opts = {})
28
+ data, _status_code, _headers = create_review1_with_http_info(body, opts)
29
+ data
30
+ end
31
+
32
+ # Create a review for a reservation
33
+ # 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\": \"http://localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f\", \"method\": \"GET\", \"rel\": \"get-review\" }] } ```
34
+ # @param body Review for this reservation
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ChangedReviewDto, Fixnum, Hash)>] ChangedReviewDto data, response status code and response headers
37
+ def create_review1_with_http_info(body, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ReviewsApi.create_review1 ...'
40
+ end
41
+ # verify the required parameter 'body' is set
42
+ if @api_client.config.client_side_validation && body.nil?
43
+ fail ArgumentError, "Missing the required parameter 'body' when calling ReviewsApi.create_review1"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/reviews'
47
+
48
+ # query parameters
49
+ query_params = {}
50
+
51
+ # header parameters
52
+ header_params = {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = {}
60
+
61
+ # http body (model)
62
+ post_body = @api_client.object_to_http_body(body)
63
+ auth_names = ['API_TOKEN']
64
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
65
+ :header_params => header_params,
66
+ :query_params => query_params,
67
+ :form_params => form_params,
68
+ :body => post_body,
69
+ :auth_names => auth_names,
70
+ :return_type => 'ChangedReviewDto')
71
+ if @api_client.config.debugging
72
+ @api_client.config.logger.debug "API called: ReviewsApi#create_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
+ end
74
+ return data, status_code, headers
75
+ end
76
+ # Get details for a specific review
77
+ # 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}/v{X}/reviews/07f53b36-3f48-11e5-a151-feff819cdc9f ``` Example response: ``` { \"reviewId\": \"01a53b36-3f48-11e5-a151-feff819cdc9f\", \"status\": \"PUBLISHED\", \"description\": \"Description of the review\", \"rating\": 3 } ```
78
+ # @param review_id Review reviewId (UUID) to get details from
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [GetReviewDto]
81
+ def get_review1(review_id, opts = {})
82
+ data, _status_code, _headers = get_review1_with_http_info(review_id, opts)
83
+ data
84
+ end
85
+
86
+ # Get details for a specific review
87
+ # 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}/v{X}/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;
88
+ # @param review_id Review reviewId (UUID) to get details from
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Array<(GetReviewDto, Fixnum, Hash)>] GetReviewDto data, response status code and response headers
91
+ def get_review1_with_http_info(review_id, opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: ReviewsApi.get_review1 ...'
94
+ end
95
+ # verify the required parameter 'review_id' is set
96
+ if @api_client.config.client_side_validation && review_id.nil?
97
+ fail ArgumentError, "Missing the required parameter 'review_id' when calling ReviewsApi.get_review1"
98
+ end
99
+ # resource path
100
+ local_var_path = '/v1/reviews/{reviewId}'.sub('{' + 'reviewId' + '}', review_id.to_s)
101
+
102
+ # query parameters
103
+ query_params = {}
104
+
105
+ # header parameters
106
+ header_params = {}
107
+ # HTTP header 'Accept' (if needed)
108
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
109
+
110
+ # form parameters
111
+ form_params = {}
112
+
113
+ # http body (model)
114
+ post_body = nil
115
+ auth_names = ['API_TOKEN']
116
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
117
+ :header_params => header_params,
118
+ :query_params => query_params,
119
+ :form_params => form_params,
120
+ :body => post_body,
121
+ :auth_names => auth_names,
122
+ :return_type => 'GetReviewDto')
123
+ if @api_client.config.debugging
124
+ @api_client.config.logger.debug "API called: ReviewsApi#get_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
125
+ end
126
+ return data, status_code, headers
127
+ end
128
+ # Get information from reviews in a list
129
+ # 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}/v{X}/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\": \"http://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\": \"http://test.bla\", \"rating\": 6, \"description\": \"Description 9\", \"status\": \"PUBLISHED\", \"locale\": \"de_DE\" } ], \"size\": 2, \"offset\": 0, \"limit\": 10 } ```
130
+ # @param [Hash] opts the optional parameters
131
+ # @option opts [Integer] :merchant_id MerchantId to get the reviews from. Cannot be used in combination with &#39;reservationId&#39;
132
+ # @option opts [String] :reservation_id 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.
133
+ # @option opts [Integer] :offset Skip first n reviews (default to 0)
134
+ # @option opts [Integer] :limit Max number to retrieve (default to 10)
135
+ # @return [GetReviewsDto]
136
+ def get_reviews2(opts = {})
137
+ data, _status_code, _headers = get_reviews2_with_http_info(opts)
138
+ data
139
+ end
140
+
141
+ # Get information from reviews in a list
142
+ # 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}/v{X}/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;http://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;http://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;
143
+ # @param [Hash] opts the optional parameters
144
+ # @option opts [Integer] :merchant_id MerchantId to get the reviews from. Cannot be used in combination with &#39;reservationId&#39;
145
+ # @option opts [String] :reservation_id 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.
146
+ # @option opts [Integer] :offset Skip first n reviews
147
+ # @option opts [Integer] :limit Max number to retrieve
148
+ # @return [Array<(GetReviewsDto, Fixnum, Hash)>] GetReviewsDto data, response status code and response headers
149
+ def get_reviews2_with_http_info(opts = {})
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug 'Calling API: ReviewsApi.get_reviews2 ...'
152
+ end
153
+ # resource path
154
+ local_var_path = '/v1/reviews'
155
+
156
+ # query parameters
157
+ query_params = {}
158
+ query_params[:'merchantId'] = opts[:'merchant_id'] if !opts[:'merchant_id'].nil?
159
+ query_params[:'reservationId'] = opts[:'reservation_id'] if !opts[:'reservation_id'].nil?
160
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
161
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
162
+
163
+ # header parameters
164
+ header_params = {}
165
+ # HTTP header 'Accept' (if needed)
166
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
167
+
168
+ # form parameters
169
+ form_params = {}
170
+
171
+ # http body (model)
172
+ post_body = nil
173
+ auth_names = ['API_TOKEN']
174
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
175
+ :header_params => header_params,
176
+ :query_params => query_params,
177
+ :form_params => form_params,
178
+ :body => post_body,
179
+ :auth_names => auth_names,
180
+ :return_type => 'GetReviewsDto')
181
+ if @api_client.config.debugging
182
+ @api_client.config.logger.debug "API called: ReviewsApi#get_reviews2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
183
+ end
184
+ return data, status_code, headers
185
+ end
186
+ # Updated a review
187
+ # 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\": \"http://localhost:39250/v1/reviews/01a53b36-3f48-11e5-a151-feff819cdc9f\", \"method\": \"GET\", \"rel\": \"get-review\" }] } ```
188
+ # @param body Review for this reservation
189
+ # @param [Hash] opts the optional parameters
190
+ # @return [ChangedReviewDto]
191
+ def update_review1(body, opts = {})
192
+ data, _status_code, _headers = update_review1_with_http_info(body, opts)
193
+ data
194
+ end
195
+
196
+ # Updated a review
197
+ # 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;http://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;
198
+ # @param body Review for this reservation
199
+ # @param [Hash] opts the optional parameters
200
+ # @return [Array<(ChangedReviewDto, Fixnum, Hash)>] ChangedReviewDto data, response status code and response headers
201
+ def update_review1_with_http_info(body, opts = {})
202
+ if @api_client.config.debugging
203
+ @api_client.config.logger.debug 'Calling API: ReviewsApi.update_review1 ...'
204
+ end
205
+ # verify the required parameter 'body' is set
206
+ if @api_client.config.client_side_validation && body.nil?
207
+ fail ArgumentError, "Missing the required parameter 'body' when calling ReviewsApi.update_review1"
208
+ end
209
+ # resource path
210
+ local_var_path = '/v1/reviews'
211
+
212
+ # query parameters
213
+ query_params = {}
214
+
215
+ # header parameters
216
+ header_params = {}
217
+ # HTTP header 'Accept' (if needed)
218
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
219
+ # HTTP header 'Content-Type'
220
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
221
+
222
+ # form parameters
223
+ form_params = {}
224
+
225
+ # http body (model)
226
+ post_body = @api_client.object_to_http_body(body)
227
+ auth_names = ['API_TOKEN']
228
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
229
+ :header_params => header_params,
230
+ :query_params => query_params,
231
+ :form_params => form_params,
232
+ :body => post_body,
233
+ :auth_names => auth_names,
234
+ :return_type => 'ChangedReviewDto')
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug "API called: ReviewsApi#update_review1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
237
+ end
238
+ return data, status_code, headers
239
+ end
240
+ end
241
+ end
@@ -0,0 +1,111 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Quandoo
16
+ class StatusApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Provides information on the status of the service
23
+ #
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [nil]
26
+ def get_status_by_get1(opts = {})
27
+ get_status_by_get1_with_http_info(opts)
28
+ nil
29
+ end
30
+
31
+ # Provides information on the status of the service
32
+ #
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
35
+ def get_status_by_get1_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: StatusApi.get_status_by_get1 ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/v1/status'
41
+
42
+ # query parameters
43
+ query_params = {}
44
+
45
+ # header parameters
46
+ header_params = {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = {}
52
+
53
+ # http body (model)
54
+ post_body = nil
55
+ auth_names = []
56
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
57
+ :header_params => header_params,
58
+ :query_params => query_params,
59
+ :form_params => form_params,
60
+ :body => post_body,
61
+ :auth_names => auth_names)
62
+ if @api_client.config.debugging
63
+ @api_client.config.logger.debug "API called: StatusApi#get_status_by_get1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
64
+ end
65
+ return data, status_code, headers
66
+ end
67
+ # Provides information on the status of the service
68
+ #
69
+ # @param [Hash] opts the optional parameters
70
+ # @return [nil]
71
+ def get_status_by_head1(opts = {})
72
+ get_status_by_head1_with_http_info(opts)
73
+ nil
74
+ end
75
+
76
+ # Provides information on the status of the service
77
+ #
78
+ # @param [Hash] opts the optional parameters
79
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
80
+ def get_status_by_head1_with_http_info(opts = {})
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug 'Calling API: StatusApi.get_status_by_head1 ...'
83
+ end
84
+ # resource path
85
+ local_var_path = '/v1/status'
86
+
87
+ # query parameters
88
+ query_params = {}
89
+
90
+ # header parameters
91
+ header_params = {}
92
+
93
+ # form parameters
94
+ form_params = {}
95
+
96
+ # http body (model)
97
+ post_body = nil
98
+ auth_names = []
99
+ data, status_code, headers = @api_client.call_api(:HEAD, local_var_path,
100
+ :header_params => header_params,
101
+ :query_params => query_params,
102
+ :form_params => form_params,
103
+ :body => post_body,
104
+ :auth_names => auth_names)
105
+ if @api_client.config.debugging
106
+ @api_client.config.logger.debug "API called: StatusApi#get_status_by_head1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
107
+ end
108
+ return data, status_code, headers
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,76 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Quandoo
16
+ class ValidationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Validate phone number
23
+ # This endpoint validates a phone number. If optional 2-letter country code `country` is not specified, the `phoneNumber` should be formatted according to E164, which means it is expected to be in the international format with a leading `\"+\"` and no spaces or dashes, e.g. `+4930120765890`. Otherwise it may have leading zero instead of country code, e.g. `030120765890`. The endpoint will return a status `HTTP 200` which means the `phoneNumber` is successfully validated. The endpoint will return a status `HTTP 400` which means the `phoneNumber` is missing or invalid. Example curl: ``` curl https://{host}/v{X}/validations/phone-numbers?phoneNumber=030120765890&country=IT ``` Example response: ``` { \"errorMessage\": \"phoneNumber is invalid: 030120765890, country specified is: IT\", \"errorType\": \"PHONE_NUMBER_INVALID\" } ```
24
+ # @param phone_number Phone number
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :country Country code
27
+ # @return [nil]
28
+ def validate_phone_number1(phone_number, opts = {})
29
+ validate_phone_number1_with_http_info(phone_number, opts)
30
+ nil
31
+ end
32
+
33
+ # Validate phone number
34
+ # This endpoint validates a phone number. If optional 2-letter country code &#x60;country&#x60; is not specified, the &#x60;phoneNumber&#x60; should be formatted according to E164, which means it is expected to be in the international format with a leading &#x60;\&quot;+\&quot;&#x60; and no spaces or dashes, e.g. &#x60;+4930120765890&#x60;. Otherwise it may have leading zero instead of country code, e.g. &#x60;030120765890&#x60;. The endpoint will return a status &#x60;HTTP 200&#x60; which means the &#x60;phoneNumber&#x60; is successfully validated. The endpoint will return a status &#x60;HTTP 400&#x60; which means the &#x60;phoneNumber&#x60; is missing or invalid. Example curl: &#x60;&#x60;&#x60; curl https://{host}/v{X}/validations/phone-numbers?phoneNumber&#x3D;030120765890&amp;country&#x3D;IT &#x60;&#x60;&#x60; Example response: &#x60;&#x60;&#x60; { \&quot;errorMessage\&quot;: \&quot;phoneNumber is invalid: 030120765890, country specified is: IT\&quot;, \&quot;errorType\&quot;: \&quot;PHONE_NUMBER_INVALID\&quot; } &#x60;&#x60;&#x60;
35
+ # @param phone_number Phone number
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :country Country code
38
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
39
+ def validate_phone_number1_with_http_info(phone_number, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ValidationsApi.validate_phone_number1 ...'
42
+ end
43
+ # verify the required parameter 'phone_number' is set
44
+ if @api_client.config.client_side_validation && phone_number.nil?
45
+ fail ArgumentError, "Missing the required parameter 'phone_number' when calling ValidationsApi.validate_phone_number1"
46
+ end
47
+ # resource path
48
+ local_var_path = '/v1/validations/phone-numbers'
49
+
50
+ # query parameters
51
+ query_params = {}
52
+ query_params[:'phoneNumber'] = phone_number
53
+ query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
54
+
55
+ # header parameters
56
+ header_params = {}
57
+
58
+ # form parameters
59
+ form_params = {}
60
+
61
+ # http body (model)
62
+ post_body = nil
63
+ auth_names = []
64
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
65
+ :header_params => header_params,
66
+ :query_params => query_params,
67
+ :form_params => form_params,
68
+ :body => post_body,
69
+ :auth_names => auth_names)
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: ValidationsApi#validate_phone_number1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,389 @@
1
+ =begin
2
+ #Quandoo API Documentation
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'json'
15
+ require 'logger'
16
+ require 'tempfile'
17
+ require 'typhoeus'
18
+ require 'uri'
19
+
20
+ module Quandoo
21
+ class ApiClient
22
+ # The Configuration object holding settings to be used in the API client.
23
+ attr_accessor :config
24
+
25
+ # Defines the headers to be used in HTTP requests of all API calls by default.
26
+ #
27
+ # @return [Hash]
28
+ attr_accessor :default_headers
29
+
30
+ # Initializes the ApiClient
31
+ # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
+ def initialize(config = Configuration.default)
33
+ @config = config
34
+ @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
35
+ @default_headers = {
36
+ 'Content-Type' => 'application/json',
37
+ 'User-Agent' => @user_agent
38
+ }
39
+ end
40
+
41
+ def self.default
42
+ @@default ||= ApiClient.new
43
+ end
44
+
45
+ # Call an API with given options.
46
+ #
47
+ # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
48
+ # the data deserialized from response body (could be nil), response status code and response headers.
49
+ def call_api(http_method, path, opts = {})
50
+ request = build_request(http_method, path, opts)
51
+ response = request.run
52
+
53
+ if @config.debugging
54
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
55
+ end
56
+
57
+ unless response.success?
58
+ if response.timed_out?
59
+ fail ApiError.new('Connection timed out')
60
+ elsif response.code == 0
61
+ # Errors from libcurl will be made visible here
62
+ fail ApiError.new(:code => 0,
63
+ :message => response.return_message)
64
+ else
65
+ fail ApiError.new(:code => response.code,
66
+ :response_headers => response.headers,
67
+ :response_body => response.body),
68
+ response.status_message
69
+ end
70
+ end
71
+
72
+ if opts[:return_type]
73
+ data = deserialize(response, opts[:return_type])
74
+ else
75
+ data = nil
76
+ end
77
+ return data, response.code, response.headers
78
+ end
79
+
80
+ # Builds the HTTP request
81
+ #
82
+ # @param [String] http_method HTTP method/verb (e.g. POST)
83
+ # @param [String] path URL path (e.g. /account/new)
84
+ # @option opts [Hash] :header_params Header parameters
85
+ # @option opts [Hash] :query_params Query parameters
86
+ # @option opts [Hash] :form_params Query parameters
87
+ # @option opts [Object] :body HTTP body (JSON/XML)
88
+ # @return [Typhoeus::Request] A Typhoeus Request
89
+ def build_request(http_method, path, opts = {})
90
+ url = build_request_url(path)
91
+ http_method = http_method.to_sym.downcase
92
+
93
+ header_params = @default_headers.merge(opts[:header_params] || {})
94
+ query_params = opts[:query_params] || {}
95
+ form_params = opts[:form_params] || {}
96
+
97
+ update_params_for_auth! header_params, query_params, opts[:auth_names]
98
+
99
+ # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
100
+ _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
101
+
102
+ req_opts = {
103
+ :method => http_method,
104
+ :headers => header_params,
105
+ :params => query_params,
106
+ :params_encoding => @config.params_encoding,
107
+ :timeout => @config.timeout,
108
+ :ssl_verifypeer => @config.verify_ssl,
109
+ :ssl_verifyhost => _verify_ssl_host,
110
+ :sslcert => @config.cert_file,
111
+ :sslkey => @config.key_file,
112
+ :verbose => @config.debugging
113
+ }
114
+
115
+ # set custom cert, if provided
116
+ req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
117
+
118
+ if [:post, :patch, :put, :delete].include?(http_method)
119
+ req_body = build_request_body(header_params, form_params, opts[:body])
120
+ req_opts.update :body => req_body
121
+ if @config.debugging
122
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
123
+ end
124
+ end
125
+
126
+ request = Typhoeus::Request.new(url, req_opts)
127
+ download_file(request) if opts[:return_type] == 'File'
128
+ request
129
+ end
130
+
131
+ # Check if the given MIME is a JSON MIME.
132
+ # JSON MIME examples:
133
+ # application/json
134
+ # application/json; charset=UTF8
135
+ # APPLICATION/JSON
136
+ # */*
137
+ # @param [String] mime MIME
138
+ # @return [Boolean] True if the MIME is application/json
139
+ def json_mime?(mime)
140
+ (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
141
+ end
142
+
143
+ # Deserialize the response to the given return type.
144
+ #
145
+ # @param [Response] response HTTP response
146
+ # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
147
+ def deserialize(response, return_type)
148
+ body = response.body
149
+
150
+ # handle file downloading - return the File instance processed in request callbacks
151
+ # note that response body is empty when the file is written in chunks in request on_body callback
152
+ return @tempfile if return_type == 'File'
153
+
154
+ return nil if body.nil? || body.empty?
155
+
156
+ # return response body directly for String return type
157
+ return body if return_type == 'String'
158
+
159
+ # ensuring a default content type
160
+ content_type = response.headers['Content-Type'] || 'application/json'
161
+
162
+ fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
163
+
164
+ begin
165
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
166
+ rescue JSON::ParserError => e
167
+ if %w(String Date DateTime).include?(return_type)
168
+ data = body
169
+ else
170
+ raise e
171
+ end
172
+ end
173
+
174
+ convert_to_type data, return_type
175
+ end
176
+
177
+ # Convert data to the given return type.
178
+ # @param [Object] data Data to be converted
179
+ # @param [String] return_type Return type
180
+ # @return [Mixed] Data in a particular type
181
+ def convert_to_type(data, return_type)
182
+ return nil if data.nil?
183
+ case return_type
184
+ when 'String'
185
+ data.to_s
186
+ when 'Integer'
187
+ data.to_i
188
+ when 'Float'
189
+ data.to_f
190
+ when 'BOOLEAN'
191
+ data == true
192
+ when 'DateTime'
193
+ # parse date time (expecting ISO 8601 format)
194
+ DateTime.parse data
195
+ when 'Date'
196
+ # parse date time (expecting ISO 8601 format)
197
+ Date.parse data
198
+ when 'Object'
199
+ # generic object (usually a Hash), return directly
200
+ data
201
+ when /\AArray<(.+)>\z/
202
+ # e.g. Array<Pet>
203
+ sub_type = $1
204
+ data.map { |item| convert_to_type(item, sub_type) }
205
+ when /\AHash\<String, (.+)\>\z/
206
+ # e.g. Hash<String, Integer>
207
+ sub_type = $1
208
+ {}.tap do |hash|
209
+ data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
210
+ end
211
+ else
212
+ # models, e.g. Pet
213
+ Quandoo.const_get(return_type).new.tap do |model|
214
+ model.build_from_hash data
215
+ end
216
+ end
217
+ end
218
+
219
+ # Save response body into a file in (the defined) temporary folder, using the filename
220
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
221
+ # The response body is written to the file in chunks in order to handle files which
222
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
223
+ # process can use.
224
+ #
225
+ # @see Configuration#temp_folder_path
226
+ def download_file(request)
227
+ tempfile = nil
228
+ encoding = nil
229
+ request.on_headers do |response|
230
+ content_disposition = response.headers['Content-Disposition']
231
+ if content_disposition && content_disposition =~ /filename=/i
232
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
233
+ prefix = sanitize_filename(filename)
234
+ else
235
+ prefix = 'download-'
236
+ end
237
+ prefix = prefix + '-' unless prefix.end_with?('-')
238
+ encoding = response.body.encoding
239
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
240
+ @tempfile = tempfile
241
+ end
242
+ request.on_body do |chunk|
243
+ chunk.force_encoding(encoding)
244
+ tempfile.write(chunk)
245
+ end
246
+ request.on_complete do |response|
247
+ tempfile.close
248
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
249
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
250
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
251
+ "explicitly with `tempfile.delete`"
252
+ end
253
+ end
254
+
255
+ # Sanitize filename by removing path.
256
+ # e.g. ../../sun.gif becomes sun.gif
257
+ #
258
+ # @param [String] filename the filename to be sanitized
259
+ # @return [String] the sanitized filename
260
+ def sanitize_filename(filename)
261
+ filename.gsub(/.*[\/\\]/, '')
262
+ end
263
+
264
+ def build_request_url(path)
265
+ # Add leading and trailing slashes to path
266
+ path = "/#{path}".gsub(/\/+/, '/')
267
+ URI.encode(@config.base_url + path)
268
+ end
269
+
270
+ # Builds the HTTP request body
271
+ #
272
+ # @param [Hash] header_params Header parameters
273
+ # @param [Hash] form_params Query parameters
274
+ # @param [Object] body HTTP body (JSON/XML)
275
+ # @return [String] HTTP body data in the form of string
276
+ def build_request_body(header_params, form_params, body)
277
+ # http form
278
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
279
+ header_params['Content-Type'] == 'multipart/form-data'
280
+ data = {}
281
+ form_params.each do |key, value|
282
+ case value
283
+ when ::File, ::Array, nil
284
+ # let typhoeus handle File, Array and nil parameters
285
+ data[key] = value
286
+ else
287
+ data[key] = value.to_s
288
+ end
289
+ end
290
+ elsif body
291
+ data = body.is_a?(String) ? body : body.to_json
292
+ else
293
+ data = nil
294
+ end
295
+ data
296
+ end
297
+
298
+ # Update hearder and query params based on authentication settings.
299
+ #
300
+ # @param [Hash] header_params Header parameters
301
+ # @param [Hash] query_params Query parameters
302
+ # @param [String] auth_names Authentication scheme name
303
+ def update_params_for_auth!(header_params, query_params, auth_names)
304
+ Array(auth_names).each do |auth_name|
305
+ auth_setting = @config.auth_settings[auth_name]
306
+ next unless auth_setting
307
+ case auth_setting[:in]
308
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
309
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
310
+ else fail ArgumentError, 'Authentication token must be in `query` of `header`'
311
+ end
312
+ end
313
+ end
314
+
315
+ # Sets user agent in HTTP header
316
+ #
317
+ # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
318
+ def user_agent=(user_agent)
319
+ @user_agent = user_agent
320
+ @default_headers['User-Agent'] = @user_agent
321
+ end
322
+
323
+ # Return Accept header based on an array of accepts provided.
324
+ # @param [Array] accepts array for Accept
325
+ # @return [String] the Accept header (e.g. application/json)
326
+ def select_header_accept(accepts)
327
+ return nil if accepts.nil? || accepts.empty?
328
+ # use JSON when present, otherwise use all of the provided
329
+ json_accept = accepts.find { |s| json_mime?(s) }
330
+ json_accept || accepts.join(',')
331
+ end
332
+
333
+ # Return Content-Type header based on an array of content types provided.
334
+ # @param [Array] content_types array for Content-Type
335
+ # @return [String] the Content-Type header (e.g. application/json)
336
+ def select_header_content_type(content_types)
337
+ # use application/json by default
338
+ return 'application/json' if content_types.nil? || content_types.empty?
339
+ # use JSON when present, otherwise use the first one
340
+ json_content_type = content_types.find { |s| json_mime?(s) }
341
+ json_content_type || content_types.first
342
+ end
343
+
344
+ # Convert object (array, hash, object, etc) to JSON string.
345
+ # @param [Object] model object to be converted into JSON string
346
+ # @return [String] JSON string representation of the object
347
+ def object_to_http_body(model)
348
+ return model if model.nil? || model.is_a?(String)
349
+ local_body = nil
350
+ if model.is_a?(Array)
351
+ local_body = model.map { |m| object_to_hash(m) }
352
+ else
353
+ local_body = object_to_hash(model)
354
+ end
355
+ local_body.to_json
356
+ end
357
+
358
+ # Convert object(non-array) to hash.
359
+ # @param [Object] obj object to be converted into JSON string
360
+ # @return [String] JSON string representation of the object
361
+ def object_to_hash(obj)
362
+ if obj.respond_to?(:to_hash)
363
+ obj.to_hash
364
+ else
365
+ obj
366
+ end
367
+ end
368
+
369
+ # Build parameter value according to the given collection format.
370
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
371
+ def build_collection_param(param, collection_format)
372
+ case collection_format
373
+ when :csv
374
+ param.join(',')
375
+ when :ssv
376
+ param.join(' ')
377
+ when :tsv
378
+ param.join("\t")
379
+ when :pipes
380
+ param.join('|')
381
+ when :multi
382
+ # return the array directly as typhoeus will handle it as expected
383
+ param
384
+ else
385
+ fail "unknown collection format: #{collection_format.inspect}"
386
+ end
387
+ end
388
+ end
389
+ end