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,235 +0,0 @@
1
- =begin
2
- #Getaround Owner API
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.
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: owner-api@getaround.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.6.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module GetAroundOwner
17
- class GetaroundUnavailabilitiesDeletedAllOfData
18
- # ID of the related car
19
- attr_accessor :car_id
20
-
21
- # The ISO8601 formatted beginning of the unavailability's period
22
- attr_accessor :starts_at
23
-
24
- # The ISO8601 formatted ending of the unavailability's period
25
- attr_accessor :ends_at
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'car_id' => :'car_id',
31
- :'starts_at' => :'starts_at',
32
- :'ends_at' => :'ends_at'
33
- }
34
- end
35
-
36
- # Returns all the JSON keys this model knows about
37
- def self.acceptable_attributes
38
- attribute_map.values
39
- end
40
-
41
- # Attribute type mapping.
42
- def self.openapi_types
43
- {
44
- :'car_id' => :'Integer',
45
- :'starts_at' => :'Time',
46
- :'ends_at' => :'Time'
47
- }
48
- end
49
-
50
- # List of attributes with nullable: true
51
- def self.openapi_nullable
52
- Set.new([
53
- ])
54
- end
55
-
56
- # Initializes the object
57
- # @param [Hash] attributes Model attributes in the form of hash
58
- def initialize(attributes = {})
59
- if (!attributes.is_a?(Hash))
60
- fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::GetaroundUnavailabilitiesDeletedAllOfData` initialize method"
61
- end
62
-
63
- # check to see if the attribute exists and convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::GetaroundUnavailabilitiesDeletedAllOfData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
- end
68
- h[k.to_sym] = v
69
- }
70
-
71
- if attributes.key?(:'car_id')
72
- self.car_id = attributes[:'car_id']
73
- end
74
-
75
- if attributes.key?(:'starts_at')
76
- self.starts_at = attributes[:'starts_at']
77
- end
78
-
79
- if attributes.key?(:'ends_at')
80
- self.ends_at = attributes[:'ends_at']
81
- end
82
- end
83
-
84
- # Show invalid properties with the reasons. Usually used together with valid?
85
- # @return Array for valid properties with the reasons
86
- def list_invalid_properties
87
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
- invalid_properties = Array.new
89
- invalid_properties
90
- end
91
-
92
- # Check to see if the all the properties in the model are valid
93
- # @return true if the model is valid
94
- def valid?
95
- warn '[DEPRECATED] the `valid?` method is obsolete'
96
- true
97
- end
98
-
99
- # Checks equality by comparing each attribute.
100
- # @param [Object] Object to be compared
101
- def ==(o)
102
- return true if self.equal?(o)
103
- self.class == o.class &&
104
- car_id == o.car_id &&
105
- starts_at == o.starts_at &&
106
- ends_at == o.ends_at
107
- end
108
-
109
- # @see the `==` method
110
- # @param [Object] Object to be compared
111
- def eql?(o)
112
- self == o
113
- end
114
-
115
- # Calculates hash code according to all attributes.
116
- # @return [Integer] Hash code
117
- def hash
118
- [car_id, starts_at, ends_at].hash
119
- end
120
-
121
- # Builds the object from hash
122
- # @param [Hash] attributes Model attributes in the form of hash
123
- # @return [Object] Returns the model itself
124
- def self.build_from_hash(attributes)
125
- return nil unless attributes.is_a?(Hash)
126
- attributes = attributes.transform_keys(&:to_sym)
127
- transformed_hash = {}
128
- openapi_types.each_pair do |key, type|
129
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
130
- transformed_hash["#{key}"] = nil
131
- elsif type =~ /\AArray<(.*)>/i
132
- # check to ensure the input is an array given that the attribute
133
- # is documented as an array but the input is not
134
- if attributes[attribute_map[key]].is_a?(Array)
135
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
- end
137
- elsif !attributes[attribute_map[key]].nil?
138
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
- end
140
- end
141
- new(transformed_hash)
142
- end
143
-
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def self._deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
- when :Object
167
- # generic object (usually a Hash), return directly
168
- value
169
- when /\AArray<(?<inner_type>.+)>\z/
170
- inner_type = Regexp.last_match[:inner_type]
171
- value.map { |v| _deserialize(inner_type, v) }
172
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
- k_type = Regexp.last_match[:k_type]
174
- v_type = Regexp.last_match[:v_type]
175
- {}.tap do |hash|
176
- value.each do |k, v|
177
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
- end
179
- end
180
- else # model
181
- # models (e.g. Pet) or oneOf
182
- klass = GetAroundOwner.const_get(type)
183
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
- end
185
- end
186
-
187
- # Returns the string representation of the object
188
- # @return [String] String presentation of the object
189
- def to_s
190
- to_hash.to_s
191
- end
192
-
193
- # to_body is an alias to to_hash (backward compatibility)
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_body
196
- to_hash
197
- end
198
-
199
- # Returns the object in the form of hash
200
- # @return [Hash] Returns the object in the form of hash
201
- def to_hash
202
- hash = {}
203
- self.class.attribute_map.each_pair do |attr, param|
204
- value = self.send(attr)
205
- if value.nil?
206
- is_nullable = self.class.openapi_nullable.include?(attr)
207
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
- end
209
-
210
- hash[param] = _to_hash(value)
211
- end
212
- hash
213
- end
214
-
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
232
-
233
- end
234
-
235
- end
@@ -1,302 +0,0 @@
1
- =begin
2
- #Getaround Owner API
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.
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: owner-api@getaround.com
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.6.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module GetAroundOwner
17
- # An unavailability.
18
- class GetaroundUnavailability
19
- # ID of the related car
20
- attr_accessor :car_id
21
-
22
- # The ISO8601 formatted beginning of the unavailability's period
23
- attr_accessor :starts_at
24
-
25
- # The ISO8601 formatted ending of the unavailability's period
26
- attr_accessor :ends_at
27
-
28
- # The reason of the unavailability of the car.
29
- attr_accessor :reason
30
-
31
- class EnumAttributeValidator
32
- attr_reader :datatype
33
- attr_reader :allowable_values
34
-
35
- def initialize(datatype, allowable_values)
36
- @allowable_values = allowable_values.map do |value|
37
- case datatype.to_s
38
- when /Integer/i
39
- value.to_i
40
- when /Float/i
41
- value.to_f
42
- else
43
- value
44
- end
45
- end
46
- end
47
-
48
- def valid?(value)
49
- !value || allowable_values.include?(value)
50
- end
51
- end
52
-
53
- # Attribute mapping from ruby-style variable name to JSON key.
54
- def self.attribute_map
55
- {
56
- :'car_id' => :'car_id',
57
- :'starts_at' => :'starts_at',
58
- :'ends_at' => :'ends_at',
59
- :'reason' => :'reason'
60
- }
61
- end
62
-
63
- # Returns all the JSON keys this model knows about
64
- def self.acceptable_attributes
65
- attribute_map.values
66
- end
67
-
68
- # Attribute type mapping.
69
- def self.openapi_types
70
- {
71
- :'car_id' => :'Integer',
72
- :'starts_at' => :'Time',
73
- :'ends_at' => :'Time',
74
- :'reason' => :'String'
75
- }
76
- end
77
-
78
- # List of attributes with nullable: true
79
- def self.openapi_nullable
80
- Set.new([
81
- :'reason'
82
- ])
83
- end
84
-
85
- # Initializes the object
86
- # @param [Hash] attributes Model attributes in the form of hash
87
- def initialize(attributes = {})
88
- if (!attributes.is_a?(Hash))
89
- fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::GetaroundUnavailability` initialize method"
90
- end
91
-
92
- # check to see if the attribute exists and convert string to symbol for hash key
93
- attributes = attributes.each_with_object({}) { |(k, v), h|
94
- if (!self.class.attribute_map.key?(k.to_sym))
95
- fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::GetaroundUnavailability`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
- end
97
- h[k.to_sym] = v
98
- }
99
-
100
- if attributes.key?(:'car_id')
101
- self.car_id = attributes[:'car_id']
102
- else
103
- self.car_id = nil
104
- end
105
-
106
- if attributes.key?(:'starts_at')
107
- self.starts_at = attributes[:'starts_at']
108
- else
109
- self.starts_at = nil
110
- end
111
-
112
- if attributes.key?(:'ends_at')
113
- self.ends_at = attributes[:'ends_at']
114
- else
115
- self.ends_at = nil
116
- end
117
-
118
- if attributes.key?(:'reason')
119
- self.reason = attributes[:'reason']
120
- end
121
- end
122
-
123
- # Show invalid properties with the reasons. Usually used together with valid?
124
- # @return Array for valid properties with the reasons
125
- def list_invalid_properties
126
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
- invalid_properties = Array.new
128
- if @car_id.nil?
129
- invalid_properties.push('invalid value for "car_id", car_id cannot be nil.')
130
- end
131
-
132
- if @starts_at.nil?
133
- invalid_properties.push('invalid value for "starts_at", starts_at cannot be nil.')
134
- end
135
-
136
- if @ends_at.nil?
137
- invalid_properties.push('invalid value for "ends_at", ends_at cannot be nil.')
138
- end
139
-
140
- invalid_properties
141
- end
142
-
143
- # Check to see if the all the properties in the model are valid
144
- # @return true if the model is valid
145
- def valid?
146
- warn '[DEPRECATED] the `valid?` method is obsolete'
147
- return false if @car_id.nil?
148
- return false if @starts_at.nil?
149
- return false if @ends_at.nil?
150
- reason_validator = EnumAttributeValidator.new('String', ["check_up", "repairs", "connect_issues", "repatriation", "booked", "other", "null"])
151
- return false unless reason_validator.valid?(@reason)
152
- true
153
- end
154
-
155
- # Custom attribute writer method checking allowed values (enum).
156
- # @param [Object] reason Object to be assigned
157
- def reason=(reason)
158
- validator = EnumAttributeValidator.new('String', ["check_up", "repairs", "connect_issues", "repatriation", "booked", "other", "null"])
159
- unless validator.valid?(reason)
160
- fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}."
161
- end
162
- @reason = reason
163
- end
164
-
165
- # Checks equality by comparing each attribute.
166
- # @param [Object] Object to be compared
167
- def ==(o)
168
- return true if self.equal?(o)
169
- self.class == o.class &&
170
- car_id == o.car_id &&
171
- starts_at == o.starts_at &&
172
- ends_at == o.ends_at &&
173
- reason == o.reason
174
- end
175
-
176
- # @see the `==` method
177
- # @param [Object] Object to be compared
178
- def eql?(o)
179
- self == o
180
- end
181
-
182
- # Calculates hash code according to all attributes.
183
- # @return [Integer] Hash code
184
- def hash
185
- [car_id, starts_at, ends_at, reason].hash
186
- end
187
-
188
- # Builds the object from hash
189
- # @param [Hash] attributes Model attributes in the form of hash
190
- # @return [Object] Returns the model itself
191
- def self.build_from_hash(attributes)
192
- return nil unless attributes.is_a?(Hash)
193
- attributes = attributes.transform_keys(&:to_sym)
194
- transformed_hash = {}
195
- openapi_types.each_pair do |key, type|
196
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
- transformed_hash["#{key}"] = nil
198
- elsif type =~ /\AArray<(.*)>/i
199
- # check to ensure the input is an array given that the attribute
200
- # is documented as an array but the input is not
201
- if attributes[attribute_map[key]].is_a?(Array)
202
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
- end
204
- elsif !attributes[attribute_map[key]].nil?
205
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
- end
207
- end
208
- new(transformed_hash)
209
- end
210
-
211
- # Deserializes the data based on type
212
- # @param string type Data type
213
- # @param string value Value to be deserialized
214
- # @return [Object] Deserialized data
215
- def self._deserialize(type, value)
216
- case type.to_sym
217
- when :Time
218
- Time.parse(value)
219
- when :Date
220
- Date.parse(value)
221
- when :String
222
- value.to_s
223
- when :Integer
224
- value.to_i
225
- when :Float
226
- value.to_f
227
- when :Boolean
228
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
- true
230
- else
231
- false
232
- end
233
- when :Object
234
- # generic object (usually a Hash), return directly
235
- value
236
- when /\AArray<(?<inner_type>.+)>\z/
237
- inner_type = Regexp.last_match[:inner_type]
238
- value.map { |v| _deserialize(inner_type, v) }
239
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
- k_type = Regexp.last_match[:k_type]
241
- v_type = Regexp.last_match[:v_type]
242
- {}.tap do |hash|
243
- value.each do |k, v|
244
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
- end
246
- end
247
- else # model
248
- # models (e.g. Pet) or oneOf
249
- klass = GetAroundOwner.const_get(type)
250
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
- end
252
- end
253
-
254
- # Returns the string representation of the object
255
- # @return [String] String presentation of the object
256
- def to_s
257
- to_hash.to_s
258
- end
259
-
260
- # to_body is an alias to to_hash (backward compatibility)
261
- # @return [Hash] Returns the object in the form of hash
262
- def to_body
263
- to_hash
264
- end
265
-
266
- # Returns the object in the form of hash
267
- # @return [Hash] Returns the object in the form of hash
268
- def to_hash
269
- hash = {}
270
- self.class.attribute_map.each_pair do |attr, param|
271
- value = self.send(attr)
272
- if value.nil?
273
- is_nullable = self.class.openapi_nullable.include?(attr)
274
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
- end
276
-
277
- hash[param] = _to_hash(value)
278
- end
279
- hash
280
- end
281
-
282
- # Outputs non-array value in the form of hash
283
- # For object, use to_hash. Otherwise, just return the value
284
- # @param [Object] value Any valid value
285
- # @return [Hash] Returns the value in the form of hash
286
- def _to_hash(value)
287
- if value.is_a?(Array)
288
- value.compact.map { |v| _to_hash(v) }
289
- elsif value.is_a?(Hash)
290
- {}.tap do |hash|
291
- value.each { |k, v| hash[k] = _to_hash(v) }
292
- end
293
- elsif value.respond_to? :to_hash
294
- value.to_hash
295
- else
296
- value
297
- end
298
- end
299
-
300
- end
301
-
302
- end