get_around_owner 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/Owner API v1.json +2938 -0
  4. data/README.md +359 -203
  5. data/Rakefile +8 -0
  6. data/docs/Car.md +12 -0
  7. data/docs/CarId.md +6 -0
  8. data/docs/CarIdUnavailabilitiesJsonBody.md +9 -0
  9. data/docs/CarsApi.md +109 -0
  10. data/docs/CarsIndex.md +6 -0
  11. data/docs/Checkin.md +10 -0
  12. data/docs/CheckinsApi.md +113 -0
  13. data/docs/CheckinsIndex.md +6 -0
  14. data/docs/Checkout.md +11 -0
  15. data/docs/CheckoutsApi.md +113 -0
  16. data/docs/CheckoutsIndex.md +6 -0
  17. data/docs/EndsAt.md +6 -0
  18. data/docs/GetaroundCar.md +28 -0
  19. data/docs/GetaroundCarsIndexInner.md +18 -0
  20. data/docs/GetaroundCheckin.md +24 -0
  21. data/docs/GetaroundCheckinsIndexInner.md +18 -0
  22. data/docs/GetaroundCheckout.md +26 -0
  23. data/docs/GetaroundCreateMessagesRequest.md +18 -0
  24. data/docs/GetaroundCreateUnavailabilitiesRequest.md +22 -0
  25. data/docs/GetaroundDestroyUnavailabilityRequest.md +20 -0
  26. data/docs/GetaroundInvoice.md +34 -0
  27. data/docs/GetaroundInvoiceChargesInner.md +20 -0
  28. data/docs/GetaroundInvoicesIndexInner.md +18 -0
  29. data/docs/GetaroundMessage.md +26 -0
  30. data/docs/GetaroundMessagesSent.md +22 -0
  31. data/docs/GetaroundMessagesSentAllOfData.md +20 -0
  32. data/docs/GetaroundPayout.md +28 -0
  33. data/docs/GetaroundPayoutInvoicesInner.md +18 -0
  34. data/docs/GetaroundPayoutsIndexInner.md +18 -0
  35. data/docs/GetaroundReason.md +15 -0
  36. data/docs/GetaroundRental.md +32 -0
  37. data/docs/GetaroundRentalInvoicesIndexInner.md +18 -0
  38. data/docs/GetaroundRentalMessagesIndexInner.md +18 -0
  39. data/docs/GetaroundRentalsBooked.md +22 -0
  40. data/docs/GetaroundRentalsBookedAllOfData.md +18 -0
  41. data/docs/GetaroundRentalsCanceled.md +22 -0
  42. data/docs/GetaroundRentalsCarCheckedIn.md +22 -0
  43. data/docs/GetaroundRentalsCarCheckedOut.md +22 -0
  44. data/docs/GetaroundRentalsCarSwitched.md +22 -0
  45. data/docs/GetaroundRentalsIndexInner.md +18 -0
  46. data/docs/GetaroundRentalsTimesChanged.md +22 -0
  47. data/docs/GetaroundUnavailabilitiesCreated.md +22 -0
  48. data/docs/GetaroundUnavailabilitiesCreatedAllOfData.md +24 -0
  49. data/docs/GetaroundUnavailabilitiesDeleted.md +22 -0
  50. data/docs/GetaroundUnavailabilitiesDeletedAllOfData.md +22 -0
  51. data/docs/GetaroundUnavailability.md +24 -0
  52. data/docs/GetaroundUser.md +42 -0
  53. data/docs/GetaroundUsersUpdated.md +22 -0
  54. data/docs/GetaroundUsersUpdatedAllOfData.md +18 -0
  55. data/docs/GetaroundWebhook.md +22 -0
  56. data/docs/Invoice.md +15 -0
  57. data/docs/InvoicesApi.md +168 -0
  58. data/docs/InvoicesIndex.md +6 -0
  59. data/docs/Message.md +11 -0
  60. data/docs/MessagesApi.md +161 -0
  61. data/docs/MessagesSent.md +6 -0
  62. data/docs/Payout.md +12 -0
  63. data/docs/PayoutsApi.md +113 -0
  64. data/docs/PayoutsIndex.md +6 -0
  65. data/docs/Rental.md +14 -0
  66. data/docs/RentalIdMessagesJsonBody.md +7 -0
  67. data/docs/RentalInvoicesIndex.md +6 -0
  68. data/docs/RentalMessagesIndex.md +6 -0
  69. data/docs/RentalsApi.md +113 -0
  70. data/docs/RentalsBooked.md +6 -0
  71. data/docs/RentalsCanceled.md +6 -0
  72. data/docs/RentalsCarCheckedIn.md +6 -0
  73. data/docs/RentalsCarCheckedOut.md +6 -0
  74. data/docs/RentalsCarSwitched.md +6 -0
  75. data/docs/RentalsIndex.md +6 -0
  76. data/docs/RentalsTimesChanged.md +6 -0
  77. data/docs/StartsAt.md +6 -0
  78. data/docs/UnavailabilitiesApi.md +166 -0
  79. data/docs/UnavailabilitiesCreated.md +6 -0
  80. data/docs/UnavailabilitiesDeleted.md +6 -0
  81. data/docs/UnavailabilitiesIndex.md +6 -0
  82. data/docs/Unavailability.md +10 -0
  83. data/docs/User.md +19 -0
  84. data/docs/UsersApi.md +56 -0
  85. data/docs/UsersUpdated.md +6 -0
  86. data/docs/Webhook.md +9 -0
  87. data/get_around_owner-1.0.0.gem +0 -0
  88. data/get_around_owner-1.0.1.gem +0 -0
  89. data/get_around_owner-1.0.3.gem +0 -0
  90. data/get_around_owner.gemspec +39 -0
  91. data/getaround-api.gemspec +38 -0
  92. data/git_push.sh +55 -0
  93. data/lib/get_around_owner/api/cars_api.rb +25 -41
  94. data/lib/get_around_owner/api/checkins_api.rb +99 -35
  95. data/lib/get_around_owner/api/checkouts_api.rb +99 -35
  96. data/lib/get_around_owner/api/invoices_api.rb +43 -66
  97. data/lib/get_around_owner/api/messages_api.rb +149 -33
  98. data/lib/get_around_owner/api/payouts_api.rb +29 -45
  99. data/lib/get_around_owner/api/rentals_api.rb +67 -183
  100. data/lib/get_around_owner/api/unavailabilities_api.rb +124 -58
  101. data/lib/get_around_owner/api/users_api.rb +30 -36
  102. data/lib/get_around_owner/api_client.rb +71 -77
  103. data/lib/get_around_owner/api_error.rb +5 -6
  104. data/lib/get_around_owner/configuration.rb +13 -106
  105. data/lib/get_around_owner/models/{getaround_car.rb → car.rb} +36 -56
  106. data/lib/get_around_owner/models/{getaround_users_updated_all_of_data.rb → car_id.rb} +33 -50
  107. data/lib/get_around_owner/models/{getaround_destroy_unavailability_request.rb → car_id_unavailabilities_json_body.rb} +45 -47
  108. data/lib/get_around_owner/models/{getaround_rentals_booked_all_of_data.rb → cars_index.rb} +33 -50
  109. data/lib/get_around_owner/models/{getaround_checkin.rb → checkin.rb} +34 -65
  110. data/lib/get_around_owner/models/{getaround_payouts_index_inner.rb → checkins_index.rb} +32 -58
  111. data/lib/get_around_owner/models/{getaround_checkout.rb → checkout.rb} +35 -70
  112. data/lib/get_around_owner/models/checkouts_index.rb +197 -0
  113. data/lib/get_around_owner/models/ends_at.rb +198 -0
  114. data/lib/get_around_owner/models/{getaround_invoice.rb → invoice.rb} +45 -113
  115. data/lib/get_around_owner/models/invoices_index.rb +198 -0
  116. data/lib/get_around_owner/models/{getaround_message.rb → message.rb} +35 -53
  117. data/lib/get_around_owner/models/messages_sent.rb +197 -0
  118. data/lib/get_around_owner/models/{getaround_payout.rb → payout.rb} +37 -101
  119. data/lib/get_around_owner/models/payouts_index.rb +198 -0
  120. data/lib/get_around_owner/models/{getaround_rental.rb → rental.rb} +38 -100
  121. data/lib/get_around_owner/models/{getaround_create_messages_request.rb → rental_id_messages_json_body.rb} +31 -41
  122. data/lib/get_around_owner/models/rental_invoices_index.rb +198 -0
  123. data/lib/get_around_owner/models/rental_messages_index.rb +198 -0
  124. data/lib/get_around_owner/models/rentals_booked.rb +197 -0
  125. data/lib/get_around_owner/models/rentals_canceled.rb +197 -0
  126. data/lib/get_around_owner/models/rentals_car_checked_in.rb +197 -0
  127. data/lib/get_around_owner/models/rentals_car_checked_out.rb +197 -0
  128. data/lib/get_around_owner/models/rentals_car_switched.rb +197 -0
  129. data/lib/get_around_owner/models/rentals_index.rb +198 -0
  130. data/lib/get_around_owner/models/rentals_times_changed.rb +197 -0
  131. data/lib/get_around_owner/models/starts_at.rb +198 -0
  132. data/lib/get_around_owner/models/{getaround_cars_index_inner.rb → unavailabilities_created.rb} +32 -58
  133. data/lib/get_around_owner/models/unavailabilities_deleted.rb +197 -0
  134. data/lib/get_around_owner/models/unavailabilities_index.rb +198 -0
  135. data/lib/get_around_owner/models/{getaround_unavailabilities_created_all_of_data.rb → unavailability.rb} +51 -65
  136. data/lib/get_around_owner/models/{getaround_user.rb → user.rb} +43 -75
  137. data/lib/get_around_owner/models/users_updated.rb +197 -0
  138. data/lib/get_around_owner/models/{getaround_webhook.rb → webhook.rb} +38 -47
  139. data/lib/get_around_owner/version.rb +5 -6
  140. data/lib/get_around_owner.rb +38 -43
  141. data/openapi.yml +2298 -0
  142. data/spec/api/cars_api_spec.rb +13 -14
  143. data/spec/api/checkins_api_spec.rb +13 -14
  144. data/spec/api/checkouts_api_spec.rb +13 -14
  145. data/spec/api/invoices_api_spec.rb +19 -20
  146. data/spec/api/messages_api_spec.rb +14 -15
  147. data/spec/api/payouts_api_spec.rb +13 -14
  148. data/spec/api/rentals_api_spec.rb +13 -14
  149. data/spec/api/unavailabilities_api_spec.rb +14 -16
  150. data/spec/api/users_api_spec.rb +9 -10
  151. data/spec/api_client_spec.rb +225 -0
  152. data/spec/base_object_spec.rb +109 -0
  153. data/spec/{models/getaround_checkins_index_inner_spec.rb → configuration_spec.rb} +26 -21
  154. data/spec/models/{getaround_reason_spec.rb → car_id_spec.rb} +18 -14
  155. data/spec/models/{getaround_unavailabilities_deleted_all_of_data_spec.rb → car_id_unavailabilities_json_body_spec.rb} +24 -20
  156. data/spec/models/{getaround_car_spec.rb → car_spec.rb} +24 -20
  157. data/spec/models/{getaround_rentals_index_inner_spec.rb → cars_index_spec.rb} +16 -18
  158. data/spec/models/{getaround_checkin_spec.rb → checkin_spec.rb} +22 -18
  159. data/spec/models/checkins_index_spec.rb +34 -0
  160. data/spec/models/{getaround_checkout_spec.rb → checkout_spec.rb} +23 -19
  161. data/spec/models/checkouts_index_spec.rb +34 -0
  162. data/spec/models/ends_at_spec.rb +34 -0
  163. data/spec/models/{getaround_invoice_spec.rb → invoice_spec.rb} +27 -31
  164. data/spec/models/invoices_index_spec.rb +34 -0
  165. data/spec/models/{getaround_message_spec.rb → message_spec.rb} +23 -19
  166. data/spec/models/messages_sent_spec.rb +34 -0
  167. data/spec/models/{getaround_payout_spec.rb → payout_spec.rb} +24 -24
  168. data/spec/models/payouts_index_spec.rb +34 -0
  169. data/spec/models/{getaround_create_messages_request_spec.rb → rental_id_messages_json_body_spec.rb} +19 -15
  170. data/spec/models/rental_invoices_index_spec.rb +34 -0
  171. data/spec/models/rental_messages_index_spec.rb +34 -0
  172. data/spec/models/{getaround_rental_spec.rb → rental_spec.rb} +26 -22
  173. data/spec/models/rentals_booked_spec.rb +34 -0
  174. data/spec/models/rentals_canceled_spec.rb +34 -0
  175. data/spec/models/rentals_car_checked_in_spec.rb +34 -0
  176. data/spec/models/rentals_car_checked_out_spec.rb +34 -0
  177. data/spec/models/rentals_car_switched_spec.rb +34 -0
  178. data/spec/models/rentals_index_spec.rb +34 -0
  179. data/spec/models/rentals_times_changed_spec.rb +34 -0
  180. data/spec/models/starts_at_spec.rb +34 -0
  181. data/spec/models/{getaround_cars_index_inner_spec.rb → unavailabilities_created_spec.rb} +16 -18
  182. data/spec/models/{getaround_payouts_index_inner_spec.rb → unavailabilities_deleted_spec.rb} +16 -18
  183. data/spec/models/unavailabilities_index_spec.rb +34 -0
  184. data/spec/models/{getaround_unavailabilities_created_all_of_data_spec.rb → unavailability_spec.rb} +22 -18
  185. data/spec/models/{getaround_user_spec.rb → user_spec.rb} +31 -27
  186. data/spec/models/users_updated_spec.rb +34 -0
  187. data/spec/models/{getaround_webhook_spec.rb → webhook_spec.rb} +21 -17
  188. data/spec/spec_helper.rb +4 -5
  189. metadata +276 -119
  190. data/lib/get_around_owner/models/getaround_checkins_index_inner.rb +0 -222
  191. data/lib/get_around_owner/models/getaround_create_unavailabilities_request.rb +0 -283
  192. data/lib/get_around_owner/models/getaround_invoice_charges_inner.rb +0 -225
  193. data/lib/get_around_owner/models/getaround_invoices_index_inner.rb +0 -223
  194. data/lib/get_around_owner/models/getaround_messages_sent.rb +0 -257
  195. data/lib/get_around_owner/models/getaround_messages_sent_all_of_data.rb +0 -225
  196. data/lib/get_around_owner/models/getaround_payout_invoices_inner.rb +0 -223
  197. data/lib/get_around_owner/models/getaround_reason.rb +0 -45
  198. data/lib/get_around_owner/models/getaround_rental_invoices_index_inner.rb +0 -223
  199. data/lib/get_around_owner/models/getaround_rental_messages_index_inner.rb +0 -223
  200. data/lib/get_around_owner/models/getaround_rentals_booked.rb +0 -257
  201. data/lib/get_around_owner/models/getaround_rentals_canceled.rb +0 -257
  202. data/lib/get_around_owner/models/getaround_rentals_car_checked_in.rb +0 -257
  203. data/lib/get_around_owner/models/getaround_rentals_car_checked_out.rb +0 -257
  204. data/lib/get_around_owner/models/getaround_rentals_car_switched.rb +0 -257
  205. data/lib/get_around_owner/models/getaround_rentals_index_inner.rb +0 -223
  206. data/lib/get_around_owner/models/getaround_rentals_times_changed.rb +0 -257
  207. data/lib/get_around_owner/models/getaround_unavailabilities_created.rb +0 -257
  208. data/lib/get_around_owner/models/getaround_unavailabilities_deleted.rb +0 -257
  209. data/lib/get_around_owner/models/getaround_unavailabilities_deleted_all_of_data.rb +0 -235
  210. data/lib/get_around_owner/models/getaround_unavailability.rb +0 -302
  211. data/lib/get_around_owner/models/getaround_users_updated.rb +0 -257
  212. data/spec/models/getaround_create_unavailabilities_request_spec.rb +0 -52
  213. data/spec/models/getaround_destroy_unavailability_request_spec.rb +0 -42
  214. data/spec/models/getaround_invoice_charges_inner_spec.rb +0 -42
  215. data/spec/models/getaround_invoices_index_inner_spec.rb +0 -36
  216. data/spec/models/getaround_messages_sent_all_of_data_spec.rb +0 -42
  217. data/spec/models/getaround_messages_sent_spec.rb +0 -48
  218. data/spec/models/getaround_payout_invoices_inner_spec.rb +0 -36
  219. data/spec/models/getaround_rental_invoices_index_inner_spec.rb +0 -36
  220. data/spec/models/getaround_rental_messages_index_inner_spec.rb +0 -36
  221. data/spec/models/getaround_rentals_booked_all_of_data_spec.rb +0 -36
  222. data/spec/models/getaround_rentals_booked_spec.rb +0 -48
  223. data/spec/models/getaround_rentals_canceled_spec.rb +0 -48
  224. data/spec/models/getaround_rentals_car_checked_in_spec.rb +0 -48
  225. data/spec/models/getaround_rentals_car_checked_out_spec.rb +0 -48
  226. data/spec/models/getaround_rentals_car_switched_spec.rb +0 -48
  227. data/spec/models/getaround_rentals_times_changed_spec.rb +0 -48
  228. data/spec/models/getaround_unavailabilities_created_spec.rb +0 -48
  229. data/spec/models/getaround_unavailabilities_deleted_spec.rb +0 -48
  230. data/spec/models/getaround_unavailability_spec.rb +0 -58
  231. data/spec/models/getaround_users_updated_all_of_data_spec.rb +0 -36
  232. data/spec/models/getaround_users_updated_spec.rb +0 -48
@@ -1,24 +1,23 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.6.0
10
-
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.66
11
10
  =end
12
11
 
13
12
  require 'date'
14
- require 'time'
15
13
 
16
14
  module GetAroundOwner
17
15
  # A webhook object
18
- class GetaroundWebhook
16
+ class Webhook
19
17
  # The webhook event type
20
18
  attr_accessor :type
21
19
 
20
+ # The webhook event data
22
21
  attr_accessor :data
23
22
 
24
23
  # The webhook event occurred at timestamp
@@ -33,70 +32,61 @@ module GetAroundOwner
33
32
  }
34
33
  end
35
34
 
36
- # Returns all the JSON keys this model knows about
37
- def self.acceptable_attributes
38
- attribute_map.values
39
- end
40
-
41
35
  # Attribute type mapping.
42
36
  def self.openapi_types
43
37
  {
44
- :'type' => :'String',
38
+ :'type' => :'Object',
45
39
  :'data' => :'Object',
46
- :'occurred_at' => :'Time'
40
+ :'occurred_at' => :'Object'
47
41
  }
48
42
  end
49
43
 
50
44
  # List of attributes with nullable: true
51
45
  def self.openapi_nullable
52
46
  Set.new([
53
- :'data',
54
47
  ])
55
48
  end
56
-
49
+
57
50
  # Initializes the object
58
51
  # @param [Hash] attributes Model attributes in the form of hash
59
52
  def initialize(attributes = {})
60
53
  if (!attributes.is_a?(Hash))
61
- fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::GetaroundWebhook` initialize method"
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::Webhook` initialize method"
62
55
  end
63
56
 
64
57
  # check to see if the attribute exists and convert string to symbol for hash key
65
58
  attributes = attributes.each_with_object({}) { |(k, v), h|
66
59
  if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::GetaroundWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::Webhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
61
  end
69
62
  h[k.to_sym] = v
70
63
  }
71
64
 
72
65
  if attributes.key?(:'type')
73
66
  self.type = attributes[:'type']
74
- else
75
- self.type = nil
76
67
  end
77
68
 
78
69
  if attributes.key?(:'data')
79
70
  self.data = attributes[:'data']
80
- else
81
- self.data = nil
82
71
  end
83
72
 
84
73
  if attributes.key?(:'occurred_at')
85
74
  self.occurred_at = attributes[:'occurred_at']
86
- else
87
- self.occurred_at = nil
88
75
  end
89
76
  end
90
77
 
91
78
  # Show invalid properties with the reasons. Usually used together with valid?
92
79
  # @return Array for valid properties with the reasons
93
80
  def list_invalid_properties
94
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
81
  invalid_properties = Array.new
96
82
  if @type.nil?
97
83
  invalid_properties.push('invalid value for "type", type cannot be nil.')
98
84
  end
99
85
 
86
+ if @data.nil?
87
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
88
+ end
89
+
100
90
  if @occurred_at.nil?
101
91
  invalid_properties.push('invalid value for "occurred_at", occurred_at cannot be nil.')
102
92
  end
@@ -107,8 +97,8 @@ module GetAroundOwner
107
97
  # Check to see if the all the properties in the model are valid
108
98
  # @return true if the model is valid
109
99
  def valid?
110
- warn '[DEPRECATED] the `valid?` method is obsolete'
111
100
  return false if @type.nil?
101
+ return false if @data.nil?
112
102
  return false if @occurred_at.nil?
113
103
  true
114
104
  end
@@ -139,33 +129,39 @@ module GetAroundOwner
139
129
  # @param [Hash] attributes Model attributes in the form of hash
140
130
  # @return [Object] Returns the model itself
141
131
  def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
142
139
  return nil unless attributes.is_a?(Hash)
143
- attributes = attributes.transform_keys(&:to_sym)
144
- transformed_hash = {}
145
- openapi_types.each_pair do |key, type|
146
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
147
- transformed_hash["#{key}"] = nil
148
- elsif type =~ /\AArray<(.*)>/i
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if type =~ /\AArray<(.*)>/i
149
142
  # check to ensure the input is an array given that the attribute
150
143
  # is documented as an array but the input is not
151
- if attributes[attribute_map[key]].is_a?(Array)
152
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
146
  end
154
- elsif !attributes[attribute_map[key]].nil?
155
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
156
151
  end
157
152
  end
158
- new(transformed_hash)
153
+
154
+ self
159
155
  end
160
156
 
161
157
  # Deserializes the data based on type
162
158
  # @param string type Data type
163
159
  # @param string value Value to be deserialized
164
160
  # @return [Object] Deserialized data
165
- def self._deserialize(type, value)
161
+ def _deserialize(type, value)
166
162
  case type.to_sym
167
- when :Time
168
- Time.parse(value)
163
+ when :DateTime
164
+ DateTime.parse(value)
169
165
  when :Date
170
166
  Date.parse(value)
171
167
  when :String
@@ -195,9 +191,7 @@ module GetAroundOwner
195
191
  end
196
192
  end
197
193
  else # model
198
- # models (e.g. Pet) or oneOf
199
- klass = GetAroundOwner.const_get(type)
200
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ GetAroundOwner.const_get(type).build_from_hash(value)
201
195
  end
202
196
  end
203
197
 
@@ -245,8 +239,5 @@ module GetAroundOwner
245
239
  else
246
240
  value
247
241
  end
248
- end
249
-
250
- end
251
-
242
+ end end
252
243
  end
@@ -1,15 +1,14 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.6.0
10
-
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.66
11
10
  =end
12
11
 
13
12
  module GetAroundOwner
14
- VERSION = '1.0.1'
13
+ VERSION = '1.0.4'
15
14
  end
@@ -1,13 +1,12 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.6.0
10
-
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.66
11
10
  =end
12
11
 
13
12
  # Common files
@@ -17,44 +16,40 @@ require 'get_around_owner/version'
17
16
  require 'get_around_owner/configuration'
18
17
 
19
18
  # Models
20
- require 'get_around_owner/models/getaround_car'
21
- require 'get_around_owner/models/getaround_cars_index_inner'
22
- require 'get_around_owner/models/getaround_checkin'
23
- require 'get_around_owner/models/getaround_checkins_index_inner'
24
- require 'get_around_owner/models/getaround_checkout'
25
- require 'get_around_owner/models/getaround_create_messages_request'
26
- require 'get_around_owner/models/getaround_create_unavailabilities_request'
27
- require 'get_around_owner/models/getaround_destroy_unavailability_request'
28
- require 'get_around_owner/models/getaround_invoice'
29
- require 'get_around_owner/models/getaround_invoice_charges_inner'
30
- require 'get_around_owner/models/getaround_invoices_index_inner'
31
- require 'get_around_owner/models/getaround_message'
32
- require 'get_around_owner/models/getaround_messages_sent'
33
- require 'get_around_owner/models/getaround_messages_sent_all_of_data'
34
- require 'get_around_owner/models/getaround_payout'
35
- require 'get_around_owner/models/getaround_payout_invoices_inner'
36
- require 'get_around_owner/models/getaround_payouts_index_inner'
37
- require 'get_around_owner/models/getaround_reason'
38
- require 'get_around_owner/models/getaround_rental'
39
- require 'get_around_owner/models/getaround_rental_invoices_index_inner'
40
- require 'get_around_owner/models/getaround_rental_messages_index_inner'
41
- require 'get_around_owner/models/getaround_rentals_booked'
42
- require 'get_around_owner/models/getaround_rentals_booked_all_of_data'
43
- require 'get_around_owner/models/getaround_rentals_canceled'
44
- require 'get_around_owner/models/getaround_rentals_car_checked_in'
45
- require 'get_around_owner/models/getaround_rentals_car_checked_out'
46
- require 'get_around_owner/models/getaround_rentals_car_switched'
47
- require 'get_around_owner/models/getaround_rentals_index_inner'
48
- require 'get_around_owner/models/getaround_rentals_times_changed'
49
- require 'get_around_owner/models/getaround_unavailabilities_created'
50
- require 'get_around_owner/models/getaround_unavailabilities_created_all_of_data'
51
- require 'get_around_owner/models/getaround_unavailabilities_deleted'
52
- require 'get_around_owner/models/getaround_unavailabilities_deleted_all_of_data'
53
- require 'get_around_owner/models/getaround_unavailability'
54
- require 'get_around_owner/models/getaround_user'
55
- require 'get_around_owner/models/getaround_users_updated'
56
- require 'get_around_owner/models/getaround_users_updated_all_of_data'
57
- require 'get_around_owner/models/getaround_webhook'
19
+ require 'get_around_owner/models/car'
20
+ require 'get_around_owner/models/car_id'
21
+ require 'get_around_owner/models/car_id_unavailabilities_json_body'
22
+ require 'get_around_owner/models/cars_index'
23
+ require 'get_around_owner/models/checkin'
24
+ require 'get_around_owner/models/checkins_index'
25
+ require 'get_around_owner/models/checkout'
26
+ require 'get_around_owner/models/checkouts_index'
27
+ require 'get_around_owner/models/ends_at'
28
+ require 'get_around_owner/models/invoice'
29
+ require 'get_around_owner/models/invoices_index'
30
+ require 'get_around_owner/models/message'
31
+ require 'get_around_owner/models/messages_sent'
32
+ require 'get_around_owner/models/payout'
33
+ require 'get_around_owner/models/payouts_index'
34
+ require 'get_around_owner/models/rental'
35
+ require 'get_around_owner/models/rental_id_messages_json_body'
36
+ require 'get_around_owner/models/rental_invoices_index'
37
+ require 'get_around_owner/models/rental_messages_index'
38
+ require 'get_around_owner/models/rentals_booked'
39
+ require 'get_around_owner/models/rentals_canceled'
40
+ require 'get_around_owner/models/rentals_car_checked_in'
41
+ require 'get_around_owner/models/rentals_car_checked_out'
42
+ require 'get_around_owner/models/rentals_car_switched'
43
+ require 'get_around_owner/models/rentals_index'
44
+ require 'get_around_owner/models/rentals_times_changed'
45
+ require 'get_around_owner/models/starts_at'
46
+ require 'get_around_owner/models/unavailabilities_created'
47
+ require 'get_around_owner/models/unavailabilities_deleted'
48
+ require 'get_around_owner/models/unavailabilities_index'
49
+ require 'get_around_owner/models/unavailability'
50
+ require 'get_around_owner/models/user'
51
+ require 'get_around_owner/models/users_updated'
52
+ require 'get_around_owner/models/webhook'
58
53
 
59
54
  # APIs
60
55
  require 'get_around_owner/api/cars_api'