get_around_owner 1.0.1 → 1.0.3
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.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Owner API v1.json +2938 -0
- data/README.md +338 -181
- data/Rakefile +8 -0
- data/docs/Car.md +12 -0
- data/docs/CarId.md +6 -0
- data/docs/CarIdUnavailabilitiesJsonBody.md +9 -0
- data/docs/CarsApi.md +110 -0
- data/docs/CarsIndex.md +6 -0
- data/docs/Checkin.md +10 -0
- data/docs/CheckinsApi.md +114 -0
- data/docs/CheckinsIndex.md +6 -0
- data/docs/Checkout.md +11 -0
- data/docs/CheckoutsApi.md +114 -0
- data/docs/CheckoutsIndex.md +6 -0
- data/docs/EndsAt.md +6 -0
- data/docs/GetaroundCar.md +28 -0
- data/docs/GetaroundCarsIndexInner.md +18 -0
- data/docs/GetaroundCheckin.md +24 -0
- data/docs/GetaroundCheckinsIndexInner.md +18 -0
- data/docs/GetaroundCheckout.md +26 -0
- data/docs/GetaroundCreateMessagesRequest.md +18 -0
- data/docs/GetaroundCreateUnavailabilitiesRequest.md +22 -0
- data/docs/GetaroundDestroyUnavailabilityRequest.md +20 -0
- data/docs/GetaroundInvoice.md +34 -0
- data/docs/GetaroundInvoiceChargesInner.md +20 -0
- data/docs/GetaroundInvoicesIndexInner.md +18 -0
- data/docs/GetaroundMessage.md +26 -0
- data/docs/GetaroundMessagesSent.md +22 -0
- data/docs/GetaroundMessagesSentAllOfData.md +20 -0
- data/docs/GetaroundPayout.md +28 -0
- data/docs/GetaroundPayoutInvoicesInner.md +18 -0
- data/docs/GetaroundPayoutsIndexInner.md +18 -0
- data/docs/GetaroundReason.md +15 -0
- data/docs/GetaroundRental.md +32 -0
- data/docs/GetaroundRentalInvoicesIndexInner.md +18 -0
- data/docs/GetaroundRentalMessagesIndexInner.md +18 -0
- data/docs/GetaroundRentalsBooked.md +22 -0
- data/docs/GetaroundRentalsBookedAllOfData.md +18 -0
- data/docs/GetaroundRentalsCanceled.md +22 -0
- data/docs/GetaroundRentalsCarCheckedIn.md +22 -0
- data/docs/GetaroundRentalsCarCheckedOut.md +22 -0
- data/docs/GetaroundRentalsCarSwitched.md +22 -0
- data/docs/GetaroundRentalsIndexInner.md +18 -0
- data/docs/GetaroundRentalsTimesChanged.md +22 -0
- data/docs/GetaroundUnavailabilitiesCreated.md +22 -0
- data/docs/GetaroundUnavailabilitiesCreatedAllOfData.md +24 -0
- data/docs/GetaroundUnavailabilitiesDeleted.md +22 -0
- data/docs/GetaroundUnavailabilitiesDeletedAllOfData.md +22 -0
- data/docs/GetaroundUnavailability.md +24 -0
- data/docs/GetaroundUser.md +42 -0
- data/docs/GetaroundUsersUpdated.md +22 -0
- data/docs/GetaroundUsersUpdatedAllOfData.md +18 -0
- data/docs/GetaroundWebhook.md +22 -0
- data/docs/Invoice.md +15 -0
- data/docs/InvoicesApi.md +169 -0
- data/docs/InvoicesIndex.md +6 -0
- data/docs/Message.md +11 -0
- data/docs/MessagesApi.md +162 -0
- data/docs/MessagesSent.md +6 -0
- data/docs/Payout.md +12 -0
- data/docs/PayoutsApi.md +114 -0
- data/docs/PayoutsIndex.md +6 -0
- data/docs/Rental.md +14 -0
- data/docs/RentalIdMessagesJsonBody.md +7 -0
- data/docs/RentalInvoicesIndex.md +6 -0
- data/docs/RentalMessagesIndex.md +6 -0
- data/docs/RentalsApi.md +114 -0
- data/docs/RentalsBooked.md +6 -0
- data/docs/RentalsCanceled.md +6 -0
- data/docs/RentalsCarCheckedIn.md +6 -0
- data/docs/RentalsCarCheckedOut.md +6 -0
- data/docs/RentalsCarSwitched.md +6 -0
- data/docs/RentalsIndex.md +6 -0
- data/docs/RentalsTimesChanged.md +6 -0
- data/docs/StartsAt.md +6 -0
- data/docs/UnavailabilitiesApi.md +167 -0
- data/docs/UnavailabilitiesCreated.md +6 -0
- data/docs/UnavailabilitiesDeleted.md +6 -0
- data/docs/UnavailabilitiesIndex.md +6 -0
- data/docs/Unavailability.md +10 -0
- data/docs/User.md +19 -0
- data/docs/UsersApi.md +57 -0
- data/docs/UsersUpdated.md +6 -0
- data/docs/Webhook.md +9 -0
- data/get_around_owner-1.0.0.gem +0 -0
- data/get_around_owner-1.0.1.gem +0 -0
- data/get_around_owner.gemspec +39 -0
- data/getaround-api.gemspec +38 -0
- data/git_push.sh +55 -0
- data/lib/{get_around_owner → getaround-api}/api/cars_api.rb +25 -41
- data/lib/getaround-api/api/checkins_api.rb +146 -0
- data/lib/getaround-api/api/checkouts_api.rb +146 -0
- data/lib/{get_around_owner → getaround-api}/api/invoices_api.rb +43 -66
- data/lib/getaround-api/api/messages_api.rb +198 -0
- data/lib/{get_around_owner → getaround-api}/api/payouts_api.rb +29 -45
- data/lib/getaround-api/api/rentals_api.rb +146 -0
- data/lib/getaround-api/api/unavailabilities_api.rb +208 -0
- data/lib/{get_around_owner/api/messages_api.rb → getaround-api/api/users_api.rb} +31 -37
- data/lib/{get_around_owner → getaround-api}/api_client.rb +71 -77
- data/lib/{get_around_owner → getaround-api}/api_error.rb +5 -6
- data/lib/{get_around_owner → getaround-api}/configuration.rb +13 -106
- data/lib/{get_around_owner/models/getaround_car.rb → getaround-api/models/car.rb} +36 -56
- data/lib/{get_around_owner/models/getaround_users_updated_all_of_data.rb → getaround-api/models/car_id.rb} +33 -50
- data/lib/{get_around_owner/models/getaround_destroy_unavailability_request.rb → getaround-api/models/car_id_unavailabilities_json_body.rb} +45 -47
- data/lib/{get_around_owner/models/getaround_rentals_booked_all_of_data.rb → getaround-api/models/cars_index.rb} +33 -50
- data/lib/{get_around_owner/models/getaround_checkin.rb → getaround-api/models/checkin.rb} +34 -65
- data/lib/{get_around_owner/models/getaround_rentals_index_inner.rb → getaround-api/models/checkins_index.rb} +32 -58
- data/lib/{get_around_owner/models/getaround_checkout.rb → getaround-api/models/checkout.rb} +35 -70
- data/lib/getaround-api/models/checkouts_index.rb +197 -0
- data/lib/getaround-api/models/ends_at.rb +198 -0
- data/lib/{get_around_owner/models/getaround_invoice.rb → getaround-api/models/invoice.rb} +45 -113
- data/lib/getaround-api/models/invoices_index.rb +198 -0
- data/lib/{get_around_owner/models/getaround_message.rb → getaround-api/models/message.rb} +35 -53
- data/lib/getaround-api/models/messages_sent.rb +197 -0
- data/lib/{get_around_owner/models/getaround_payout.rb → getaround-api/models/payout.rb} +37 -101
- data/lib/getaround-api/models/payouts_index.rb +198 -0
- data/lib/{get_around_owner/models/getaround_rental.rb → getaround-api/models/rental.rb} +38 -100
- data/lib/{get_around_owner/models/getaround_create_messages_request.rb → getaround-api/models/rental_id_messages_json_body.rb} +31 -41
- data/lib/getaround-api/models/rental_invoices_index.rb +198 -0
- data/lib/getaround-api/models/rental_messages_index.rb +198 -0
- data/lib/getaround-api/models/rentals_booked.rb +197 -0
- data/lib/getaround-api/models/rentals_canceled.rb +197 -0
- data/lib/getaround-api/models/rentals_car_checked_in.rb +197 -0
- data/lib/getaround-api/models/rentals_car_checked_out.rb +197 -0
- data/lib/getaround-api/models/rentals_car_switched.rb +197 -0
- data/lib/getaround-api/models/rentals_index.rb +198 -0
- data/lib/getaround-api/models/rentals_times_changed.rb +197 -0
- data/lib/getaround-api/models/starts_at.rb +198 -0
- data/lib/{get_around_owner/models/getaround_cars_index_inner.rb → getaround-api/models/unavailabilities_created.rb} +32 -58
- data/lib/getaround-api/models/unavailabilities_deleted.rb +197 -0
- data/lib/getaround-api/models/unavailabilities_index.rb +198 -0
- data/lib/{get_around_owner/models/getaround_unavailabilities_created_all_of_data.rb → getaround-api/models/unavailability.rb} +51 -65
- data/lib/{get_around_owner/models/getaround_user.rb → getaround-api/models/user.rb} +43 -75
- data/lib/getaround-api/models/users_updated.rb +197 -0
- data/lib/{get_around_owner/models/getaround_webhook.rb → getaround-api/models/webhook.rb} +38 -47
- data/lib/{get_around_owner → getaround-api}/version.rb +5 -6
- data/lib/getaround-api.rb +81 -0
- data/openapi.yml +2298 -0
- data/spec/api/cars_api_spec.rb +13 -14
- data/spec/api/checkins_api_spec.rb +13 -14
- data/spec/api/checkouts_api_spec.rb +13 -14
- data/spec/api/invoices_api_spec.rb +19 -20
- data/spec/api/messages_api_spec.rb +14 -15
- data/spec/api/payouts_api_spec.rb +13 -14
- data/spec/api/rentals_api_spec.rb +13 -14
- data/spec/api/unavailabilities_api_spec.rb +14 -16
- data/spec/api/users_api_spec.rb +9 -10
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/{models/getaround_checkins_index_inner_spec.rb → configuration_spec.rb} +26 -21
- data/spec/models/{getaround_reason_spec.rb → car_id_spec.rb} +18 -14
- data/spec/models/{getaround_unavailabilities_deleted_all_of_data_spec.rb → car_id_unavailabilities_json_body_spec.rb} +24 -20
- data/spec/models/{getaround_car_spec.rb → car_spec.rb} +24 -20
- data/spec/models/cars_index_spec.rb +34 -0
- data/spec/models/{getaround_checkin_spec.rb → checkin_spec.rb} +22 -18
- data/spec/models/checkins_index_spec.rb +34 -0
- data/spec/models/{getaround_checkout_spec.rb → checkout_spec.rb} +23 -19
- data/spec/models/checkouts_index_spec.rb +34 -0
- data/spec/models/ends_at_spec.rb +34 -0
- data/spec/models/{getaround_invoice_spec.rb → invoice_spec.rb} +27 -31
- data/spec/models/invoices_index_spec.rb +34 -0
- data/spec/models/{getaround_message_spec.rb → message_spec.rb} +23 -19
- data/spec/models/messages_sent_spec.rb +34 -0
- data/spec/models/{getaround_payout_spec.rb → payout_spec.rb} +24 -24
- data/spec/models/payouts_index_spec.rb +34 -0
- data/spec/models/{getaround_create_messages_request_spec.rb → rental_id_messages_json_body_spec.rb} +19 -15
- data/spec/models/{getaround_rentals_index_inner_spec.rb → rental_invoices_index_spec.rb} +16 -18
- data/spec/models/rental_messages_index_spec.rb +34 -0
- data/spec/models/{getaround_rental_spec.rb → rental_spec.rb} +26 -22
- data/spec/models/rentals_booked_spec.rb +34 -0
- data/spec/models/rentals_canceled_spec.rb +34 -0
- data/spec/models/rentals_car_checked_in_spec.rb +34 -0
- data/spec/models/rentals_car_checked_out_spec.rb +34 -0
- data/spec/models/rentals_car_switched_spec.rb +34 -0
- data/spec/models/rentals_index_spec.rb +34 -0
- data/spec/models/rentals_times_changed_spec.rb +34 -0
- data/spec/models/starts_at_spec.rb +34 -0
- data/spec/models/{getaround_cars_index_inner_spec.rb → unavailabilities_created_spec.rb} +16 -18
- data/spec/models/{getaround_payouts_index_inner_spec.rb → unavailabilities_deleted_spec.rb} +16 -18
- data/spec/models/unavailabilities_index_spec.rb +34 -0
- data/spec/models/{getaround_unavailabilities_created_all_of_data_spec.rb → unavailability_spec.rb} +22 -18
- data/spec/models/{getaround_user_spec.rb → user_spec.rb} +31 -27
- data/spec/models/users_updated_spec.rb +34 -0
- data/spec/models/{getaround_webhook_spec.rb → webhook_spec.rb} +21 -17
- data/spec/spec_helper.rb +5 -6
- metadata +289 -133
- data/lib/get_around_owner/api/checkins_api.rb +0 -82
- data/lib/get_around_owner/api/checkouts_api.rb +0 -82
- data/lib/get_around_owner/api/rentals_api.rb +0 -262
- data/lib/get_around_owner/api/unavailabilities_api.rb +0 -142
- data/lib/get_around_owner/api/users_api.rb +0 -82
- data/lib/get_around_owner/models/getaround_checkins_index_inner.rb +0 -222
- data/lib/get_around_owner/models/getaround_create_unavailabilities_request.rb +0 -283
- data/lib/get_around_owner/models/getaround_invoice_charges_inner.rb +0 -225
- data/lib/get_around_owner/models/getaround_invoices_index_inner.rb +0 -223
- data/lib/get_around_owner/models/getaround_messages_sent.rb +0 -257
- data/lib/get_around_owner/models/getaround_messages_sent_all_of_data.rb +0 -225
- data/lib/get_around_owner/models/getaround_payout_invoices_inner.rb +0 -223
- data/lib/get_around_owner/models/getaround_payouts_index_inner.rb +0 -223
- data/lib/get_around_owner/models/getaround_reason.rb +0 -45
- data/lib/get_around_owner/models/getaround_rental_invoices_index_inner.rb +0 -223
- data/lib/get_around_owner/models/getaround_rental_messages_index_inner.rb +0 -223
- data/lib/get_around_owner/models/getaround_rentals_booked.rb +0 -257
- data/lib/get_around_owner/models/getaround_rentals_canceled.rb +0 -257
- data/lib/get_around_owner/models/getaround_rentals_car_checked_in.rb +0 -257
- data/lib/get_around_owner/models/getaround_rentals_car_checked_out.rb +0 -257
- data/lib/get_around_owner/models/getaround_rentals_car_switched.rb +0 -257
- data/lib/get_around_owner/models/getaround_rentals_times_changed.rb +0 -257
- data/lib/get_around_owner/models/getaround_unavailabilities_created.rb +0 -257
- data/lib/get_around_owner/models/getaround_unavailabilities_deleted.rb +0 -257
- data/lib/get_around_owner/models/getaround_unavailabilities_deleted_all_of_data.rb +0 -235
- data/lib/get_around_owner/models/getaround_unavailability.rb +0 -302
- data/lib/get_around_owner/models/getaround_users_updated.rb +0 -257
- data/lib/get_around_owner.rb +0 -86
- data/spec/models/getaround_create_unavailabilities_request_spec.rb +0 -52
- data/spec/models/getaround_destroy_unavailability_request_spec.rb +0 -42
- data/spec/models/getaround_invoice_charges_inner_spec.rb +0 -42
- data/spec/models/getaround_invoices_index_inner_spec.rb +0 -36
- data/spec/models/getaround_messages_sent_all_of_data_spec.rb +0 -42
- data/spec/models/getaround_messages_sent_spec.rb +0 -48
- data/spec/models/getaround_payout_invoices_inner_spec.rb +0 -36
- data/spec/models/getaround_rental_invoices_index_inner_spec.rb +0 -36
- data/spec/models/getaround_rental_messages_index_inner_spec.rb +0 -36
- data/spec/models/getaround_rentals_booked_all_of_data_spec.rb +0 -36
- data/spec/models/getaround_rentals_booked_spec.rb +0 -48
- data/spec/models/getaround_rentals_canceled_spec.rb +0 -48
- data/spec/models/getaround_rentals_car_checked_in_spec.rb +0 -48
- data/spec/models/getaround_rentals_car_checked_out_spec.rb +0 -48
- data/spec/models/getaround_rentals_car_switched_spec.rb +0 -48
- data/spec/models/getaround_rentals_times_changed_spec.rb +0 -48
- data/spec/models/getaround_unavailabilities_created_spec.rb +0 -48
- data/spec/models/getaround_unavailabilities_deleted_spec.rb +0 -48
- data/spec/models/getaround_unavailability_spec.rb +0 -58
- data/spec/models/getaround_users_updated_all_of_data_spec.rb +0 -36
- data/spec/models/getaround_users_updated_spec.rb +0 -48
@@ -1,82 +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 'cgi'
|
14
|
-
|
15
|
-
module GetAroundOwner
|
16
|
-
class CheckoutsApi
|
17
|
-
attr_accessor :api_client
|
18
|
-
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
-
@api_client = api_client
|
21
|
-
end
|
22
|
-
# Rental ended for one of your cars
|
23
|
-
# @param [Hash] opts the optional parameters
|
24
|
-
# @option opts [GetaroundRentalsCarCheckedOut] :getaround_rentals_car_checked_out This event is triggered when a rental ends and the car has been locked
|
25
|
-
# @return [nil]
|
26
|
-
def car_checked_out_rental_post(opts = {})
|
27
|
-
car_checked_out_rental_post_with_http_info(opts)
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
# Rental ended for one of your cars
|
32
|
-
# @param [Hash] opts the optional parameters
|
33
|
-
# @option opts [GetaroundRentalsCarCheckedOut] :getaround_rentals_car_checked_out This event is triggered when a rental ends and the car has been locked
|
34
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
35
|
-
def car_checked_out_rental_post_with_http_info(opts = {})
|
36
|
-
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API: CheckoutsApi.car_checked_out_rental_post ...'
|
38
|
-
end
|
39
|
-
# resource path
|
40
|
-
local_var_path = '/carCheckedOutRental'
|
41
|
-
|
42
|
-
# query parameters
|
43
|
-
query_params = opts[:query_params] || {}
|
44
|
-
|
45
|
-
# header parameters
|
46
|
-
header_params = opts[:header_params] || {}
|
47
|
-
# HTTP header 'Content-Type'
|
48
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
49
|
-
if !content_type.nil?
|
50
|
-
header_params['Content-Type'] = content_type
|
51
|
-
end
|
52
|
-
|
53
|
-
# form parameters
|
54
|
-
form_params = opts[:form_params] || {}
|
55
|
-
|
56
|
-
# http body (model)
|
57
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_rentals_car_checked_out'])
|
58
|
-
|
59
|
-
# return_type
|
60
|
-
return_type = opts[:debug_return_type]
|
61
|
-
|
62
|
-
# auth_names
|
63
|
-
auth_names = opts[:debug_auth_names] || []
|
64
|
-
|
65
|
-
new_options = opts.merge(
|
66
|
-
:operation => :"CheckoutsApi.car_checked_out_rental_post",
|
67
|
-
:header_params => header_params,
|
68
|
-
:query_params => query_params,
|
69
|
-
:form_params => form_params,
|
70
|
-
:body => post_body,
|
71
|
-
:auth_names => auth_names,
|
72
|
-
:return_type => return_type
|
73
|
-
)
|
74
|
-
|
75
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
76
|
-
if @api_client.config.debugging
|
77
|
-
@api_client.config.logger.debug "API called: CheckoutsApi#car_checked_out_rental_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
-
end
|
79
|
-
return data, status_code, headers
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,262 +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 'cgi'
|
14
|
-
|
15
|
-
module GetAroundOwner
|
16
|
-
class RentalsApi
|
17
|
-
attr_accessor :api_client
|
18
|
-
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
-
@api_client = api_client
|
21
|
-
end
|
22
|
-
# New rental booked for one of your cars
|
23
|
-
# @param [Hash] opts the optional parameters
|
24
|
-
# @option opts [GetaroundRentalsBooked] :getaround_rentals_booked This event is triggered when a new rental booking has been created for one of your cars
|
25
|
-
# @return [nil]
|
26
|
-
def booked_rental_post(opts = {})
|
27
|
-
booked_rental_post_with_http_info(opts)
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
# New rental booked for one of your cars
|
32
|
-
# @param [Hash] opts the optional parameters
|
33
|
-
# @option opts [GetaroundRentalsBooked] :getaround_rentals_booked This event is triggered when a new rental booking has been created for one of your cars
|
34
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
35
|
-
def booked_rental_post_with_http_info(opts = {})
|
36
|
-
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API: RentalsApi.booked_rental_post ...'
|
38
|
-
end
|
39
|
-
# resource path
|
40
|
-
local_var_path = '/bookedRental'
|
41
|
-
|
42
|
-
# query parameters
|
43
|
-
query_params = opts[:query_params] || {}
|
44
|
-
|
45
|
-
# header parameters
|
46
|
-
header_params = opts[:header_params] || {}
|
47
|
-
# HTTP header 'Content-Type'
|
48
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
49
|
-
if !content_type.nil?
|
50
|
-
header_params['Content-Type'] = content_type
|
51
|
-
end
|
52
|
-
|
53
|
-
# form parameters
|
54
|
-
form_params = opts[:form_params] || {}
|
55
|
-
|
56
|
-
# http body (model)
|
57
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_rentals_booked'])
|
58
|
-
|
59
|
-
# return_type
|
60
|
-
return_type = opts[:debug_return_type]
|
61
|
-
|
62
|
-
# auth_names
|
63
|
-
auth_names = opts[:debug_auth_names] || []
|
64
|
-
|
65
|
-
new_options = opts.merge(
|
66
|
-
:operation => :"RentalsApi.booked_rental_post",
|
67
|
-
:header_params => header_params,
|
68
|
-
:query_params => query_params,
|
69
|
-
:form_params => form_params,
|
70
|
-
:body => post_body,
|
71
|
-
:auth_names => auth_names,
|
72
|
-
:return_type => return_type
|
73
|
-
)
|
74
|
-
|
75
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
76
|
-
if @api_client.config.debugging
|
77
|
-
@api_client.config.logger.debug "API called: RentalsApi#booked_rental_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
-
end
|
79
|
-
return data, status_code, headers
|
80
|
-
end
|
81
|
-
|
82
|
-
# Canceled rental for one of your cars
|
83
|
-
# @param [Hash] opts the optional parameters
|
84
|
-
# @option opts [GetaroundRentalsCanceled] :getaround_rentals_canceled This event is triggered when a rental has been canceled for one of your cars
|
85
|
-
# @return [nil]
|
86
|
-
def canceled_rental_post(opts = {})
|
87
|
-
canceled_rental_post_with_http_info(opts)
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
|
91
|
-
# Canceled rental for one of your cars
|
92
|
-
# @param [Hash] opts the optional parameters
|
93
|
-
# @option opts [GetaroundRentalsCanceled] :getaround_rentals_canceled This event is triggered when a rental has been canceled for one of your cars
|
94
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
95
|
-
def canceled_rental_post_with_http_info(opts = {})
|
96
|
-
if @api_client.config.debugging
|
97
|
-
@api_client.config.logger.debug 'Calling API: RentalsApi.canceled_rental_post ...'
|
98
|
-
end
|
99
|
-
# resource path
|
100
|
-
local_var_path = '/canceledRental'
|
101
|
-
|
102
|
-
# query parameters
|
103
|
-
query_params = opts[:query_params] || {}
|
104
|
-
|
105
|
-
# header parameters
|
106
|
-
header_params = opts[:header_params] || {}
|
107
|
-
# HTTP header 'Content-Type'
|
108
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
109
|
-
if !content_type.nil?
|
110
|
-
header_params['Content-Type'] = content_type
|
111
|
-
end
|
112
|
-
|
113
|
-
# form parameters
|
114
|
-
form_params = opts[:form_params] || {}
|
115
|
-
|
116
|
-
# http body (model)
|
117
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_rentals_canceled'])
|
118
|
-
|
119
|
-
# return_type
|
120
|
-
return_type = opts[:debug_return_type]
|
121
|
-
|
122
|
-
# auth_names
|
123
|
-
auth_names = opts[:debug_auth_names] || []
|
124
|
-
|
125
|
-
new_options = opts.merge(
|
126
|
-
:operation => :"RentalsApi.canceled_rental_post",
|
127
|
-
:header_params => header_params,
|
128
|
-
:query_params => query_params,
|
129
|
-
:form_params => form_params,
|
130
|
-
:body => post_body,
|
131
|
-
:auth_names => auth_names,
|
132
|
-
:return_type => return_type
|
133
|
-
)
|
134
|
-
|
135
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
136
|
-
if @api_client.config.debugging
|
137
|
-
@api_client.config.logger.debug "API called: RentalsApi#canceled_rental_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
138
|
-
end
|
139
|
-
return data, status_code, headers
|
140
|
-
end
|
141
|
-
|
142
|
-
# There was a switch car on one of your rental
|
143
|
-
# @param [Hash] opts the optional parameters
|
144
|
-
# @option opts [GetaroundRentalsCarSwitched] :getaround_rentals_car_switched This event is triggered when an owner or customer service team member switches the car used to perform a given rental
|
145
|
-
# @return [nil]
|
146
|
-
def car_switched_rental_post(opts = {})
|
147
|
-
car_switched_rental_post_with_http_info(opts)
|
148
|
-
nil
|
149
|
-
end
|
150
|
-
|
151
|
-
# There was a switch car on one of your rental
|
152
|
-
# @param [Hash] opts the optional parameters
|
153
|
-
# @option opts [GetaroundRentalsCarSwitched] :getaround_rentals_car_switched This event is triggered when an owner or customer service team member switches the car used to perform a given rental
|
154
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
155
|
-
def car_switched_rental_post_with_http_info(opts = {})
|
156
|
-
if @api_client.config.debugging
|
157
|
-
@api_client.config.logger.debug 'Calling API: RentalsApi.car_switched_rental_post ...'
|
158
|
-
end
|
159
|
-
# resource path
|
160
|
-
local_var_path = '/carSwitchedRental'
|
161
|
-
|
162
|
-
# query parameters
|
163
|
-
query_params = opts[:query_params] || {}
|
164
|
-
|
165
|
-
# header parameters
|
166
|
-
header_params = opts[:header_params] || {}
|
167
|
-
# HTTP header 'Content-Type'
|
168
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
169
|
-
if !content_type.nil?
|
170
|
-
header_params['Content-Type'] = content_type
|
171
|
-
end
|
172
|
-
|
173
|
-
# form parameters
|
174
|
-
form_params = opts[:form_params] || {}
|
175
|
-
|
176
|
-
# http body (model)
|
177
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_rentals_car_switched'])
|
178
|
-
|
179
|
-
# return_type
|
180
|
-
return_type = opts[:debug_return_type]
|
181
|
-
|
182
|
-
# auth_names
|
183
|
-
auth_names = opts[:debug_auth_names] || []
|
184
|
-
|
185
|
-
new_options = opts.merge(
|
186
|
-
:operation => :"RentalsApi.car_switched_rental_post",
|
187
|
-
:header_params => header_params,
|
188
|
-
:query_params => query_params,
|
189
|
-
:form_params => form_params,
|
190
|
-
:body => post_body,
|
191
|
-
:auth_names => auth_names,
|
192
|
-
:return_type => return_type
|
193
|
-
)
|
194
|
-
|
195
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
196
|
-
if @api_client.config.debugging
|
197
|
-
@api_client.config.logger.debug "API called: RentalsApi#car_switched_rental_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
198
|
-
end
|
199
|
-
return data, status_code, headers
|
200
|
-
end
|
201
|
-
|
202
|
-
# Rental time change for one of your car
|
203
|
-
# @param [Hash] opts the optional parameters
|
204
|
-
# @option opts [GetaroundRentalsTimesChanged] :getaround_rentals_times_changed This event is triggered when the start or end time of a rental has been changed for one of your cars
|
205
|
-
# @return [nil]
|
206
|
-
def times_changed_rental_post(opts = {})
|
207
|
-
times_changed_rental_post_with_http_info(opts)
|
208
|
-
nil
|
209
|
-
end
|
210
|
-
|
211
|
-
# Rental time change for one of your car
|
212
|
-
# @param [Hash] opts the optional parameters
|
213
|
-
# @option opts [GetaroundRentalsTimesChanged] :getaround_rentals_times_changed This event is triggered when the start or end time of a rental has been changed for one of your cars
|
214
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
215
|
-
def times_changed_rental_post_with_http_info(opts = {})
|
216
|
-
if @api_client.config.debugging
|
217
|
-
@api_client.config.logger.debug 'Calling API: RentalsApi.times_changed_rental_post ...'
|
218
|
-
end
|
219
|
-
# resource path
|
220
|
-
local_var_path = '/timesChangedRental'
|
221
|
-
|
222
|
-
# query parameters
|
223
|
-
query_params = opts[:query_params] || {}
|
224
|
-
|
225
|
-
# header parameters
|
226
|
-
header_params = opts[:header_params] || {}
|
227
|
-
# HTTP header 'Content-Type'
|
228
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
229
|
-
if !content_type.nil?
|
230
|
-
header_params['Content-Type'] = content_type
|
231
|
-
end
|
232
|
-
|
233
|
-
# form parameters
|
234
|
-
form_params = opts[:form_params] || {}
|
235
|
-
|
236
|
-
# http body (model)
|
237
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_rentals_times_changed'])
|
238
|
-
|
239
|
-
# return_type
|
240
|
-
return_type = opts[:debug_return_type]
|
241
|
-
|
242
|
-
# auth_names
|
243
|
-
auth_names = opts[:debug_auth_names] || []
|
244
|
-
|
245
|
-
new_options = opts.merge(
|
246
|
-
:operation => :"RentalsApi.times_changed_rental_post",
|
247
|
-
:header_params => header_params,
|
248
|
-
:query_params => query_params,
|
249
|
-
:form_params => form_params,
|
250
|
-
:body => post_body,
|
251
|
-
:auth_names => auth_names,
|
252
|
-
:return_type => return_type
|
253
|
-
)
|
254
|
-
|
255
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
256
|
-
if @api_client.config.debugging
|
257
|
-
@api_client.config.logger.debug "API called: RentalsApi#times_changed_rental_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
258
|
-
end
|
259
|
-
return data, status_code, headers
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
@@ -1,142 +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 'cgi'
|
14
|
-
|
15
|
-
module GetAroundOwner
|
16
|
-
class UnavailabilitiesApi
|
17
|
-
attr_accessor :api_client
|
18
|
-
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
-
@api_client = api_client
|
21
|
-
end
|
22
|
-
# Unavailability created on one of your cars
|
23
|
-
# @param [Hash] opts the optional parameters
|
24
|
-
# @option opts [GetaroundUnavailabilitiesCreated] :getaround_unavailabilities_created This event is triggered whenever an unavailability is created (through the API or directly in the app/website). It shows the unavailability that has just been created, with the same timestamps as those entered by the user. It does not show the changes of other potential overlapping unavailabilities. For example: if an unavailability was already set between June 10 and June 20, and if the user creates a new one between June 18 and June 22, this webhook will only send information about the newly created June 18 - June 22 unavailability. It will not show that, under the hood, the unavailability from June 10 to June 20 has be deleted, and that a new unavailability from June 10 to June 22 has been created.
|
25
|
-
# @return [nil]
|
26
|
-
def created_unavailability_post(opts = {})
|
27
|
-
created_unavailability_post_with_http_info(opts)
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
# Unavailability created on one of your cars
|
32
|
-
# @param [Hash] opts the optional parameters
|
33
|
-
# @option opts [GetaroundUnavailabilitiesCreated] :getaround_unavailabilities_created This event is triggered whenever an unavailability is created (through the API or directly in the app/website). It shows the unavailability that has just been created, with the same timestamps as those entered by the user. It does not show the changes of other potential overlapping unavailabilities. For example: if an unavailability was already set between June 10 and June 20, and if the user creates a new one between June 18 and June 22, this webhook will only send information about the newly created June 18 - June 22 unavailability. It will not show that, under the hood, the unavailability from June 10 to June 20 has be deleted, and that a new unavailability from June 10 to June 22 has been created.
|
34
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
35
|
-
def created_unavailability_post_with_http_info(opts = {})
|
36
|
-
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API: UnavailabilitiesApi.created_unavailability_post ...'
|
38
|
-
end
|
39
|
-
# resource path
|
40
|
-
local_var_path = '/createdUnavailability'
|
41
|
-
|
42
|
-
# query parameters
|
43
|
-
query_params = opts[:query_params] || {}
|
44
|
-
|
45
|
-
# header parameters
|
46
|
-
header_params = opts[:header_params] || {}
|
47
|
-
# HTTP header 'Content-Type'
|
48
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
49
|
-
if !content_type.nil?
|
50
|
-
header_params['Content-Type'] = content_type
|
51
|
-
end
|
52
|
-
|
53
|
-
# form parameters
|
54
|
-
form_params = opts[:form_params] || {}
|
55
|
-
|
56
|
-
# http body (model)
|
57
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_unavailabilities_created'])
|
58
|
-
|
59
|
-
# return_type
|
60
|
-
return_type = opts[:debug_return_type]
|
61
|
-
|
62
|
-
# auth_names
|
63
|
-
auth_names = opts[:debug_auth_names] || []
|
64
|
-
|
65
|
-
new_options = opts.merge(
|
66
|
-
:operation => :"UnavailabilitiesApi.created_unavailability_post",
|
67
|
-
:header_params => header_params,
|
68
|
-
:query_params => query_params,
|
69
|
-
:form_params => form_params,
|
70
|
-
:body => post_body,
|
71
|
-
:auth_names => auth_names,
|
72
|
-
:return_type => return_type
|
73
|
-
)
|
74
|
-
|
75
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
76
|
-
if @api_client.config.debugging
|
77
|
-
@api_client.config.logger.debug "API called: UnavailabilitiesApi#created_unavailability_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
-
end
|
79
|
-
return data, status_code, headers
|
80
|
-
end
|
81
|
-
|
82
|
-
# Unavailabilities deleted on one of your cars
|
83
|
-
# @param [Hash] opts the optional parameters
|
84
|
-
# @option opts [GetaroundUnavailabilitiesDeleted] :getaround_unavailabilities_deleted This event is triggered whenever an unavailability is deleted (through the API or directly in the app/website). It shows the unavailability that has just been deleted, with the same timestamps as those entered by the user. It does not show the changes of other potential overlapping unavailabilities. For example: if an unavailability was already set between June 10 and June 20, and if the user deletes an unavailability between June 18 and June 22 (to set their car as available between this dates), this webhook will only send information about the newly deleted June 18 - June 22 unavailability. It will not show that, under the hood, the unavailability from June 10 to June 20 has be deleted, and that a new unavailability from June 10 to June 18 has been created.
|
85
|
-
# @return [nil]
|
86
|
-
def deleted_unavailability_post(opts = {})
|
87
|
-
deleted_unavailability_post_with_http_info(opts)
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
|
91
|
-
# Unavailabilities deleted on one of your cars
|
92
|
-
# @param [Hash] opts the optional parameters
|
93
|
-
# @option opts [GetaroundUnavailabilitiesDeleted] :getaround_unavailabilities_deleted This event is triggered whenever an unavailability is deleted (through the API or directly in the app/website). It shows the unavailability that has just been deleted, with the same timestamps as those entered by the user. It does not show the changes of other potential overlapping unavailabilities. For example: if an unavailability was already set between June 10 and June 20, and if the user deletes an unavailability between June 18 and June 22 (to set their car as available between this dates), this webhook will only send information about the newly deleted June 18 - June 22 unavailability. It will not show that, under the hood, the unavailability from June 10 to June 20 has be deleted, and that a new unavailability from June 10 to June 18 has been created.
|
94
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
95
|
-
def deleted_unavailability_post_with_http_info(opts = {})
|
96
|
-
if @api_client.config.debugging
|
97
|
-
@api_client.config.logger.debug 'Calling API: UnavailabilitiesApi.deleted_unavailability_post ...'
|
98
|
-
end
|
99
|
-
# resource path
|
100
|
-
local_var_path = '/deletedUnavailability'
|
101
|
-
|
102
|
-
# query parameters
|
103
|
-
query_params = opts[:query_params] || {}
|
104
|
-
|
105
|
-
# header parameters
|
106
|
-
header_params = opts[:header_params] || {}
|
107
|
-
# HTTP header 'Content-Type'
|
108
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
109
|
-
if !content_type.nil?
|
110
|
-
header_params['Content-Type'] = content_type
|
111
|
-
end
|
112
|
-
|
113
|
-
# form parameters
|
114
|
-
form_params = opts[:form_params] || {}
|
115
|
-
|
116
|
-
# http body (model)
|
117
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_unavailabilities_deleted'])
|
118
|
-
|
119
|
-
# return_type
|
120
|
-
return_type = opts[:debug_return_type]
|
121
|
-
|
122
|
-
# auth_names
|
123
|
-
auth_names = opts[:debug_auth_names] || []
|
124
|
-
|
125
|
-
new_options = opts.merge(
|
126
|
-
:operation => :"UnavailabilitiesApi.deleted_unavailability_post",
|
127
|
-
:header_params => header_params,
|
128
|
-
:query_params => query_params,
|
129
|
-
:form_params => form_params,
|
130
|
-
:body => post_body,
|
131
|
-
:auth_names => auth_names,
|
132
|
-
:return_type => return_type
|
133
|
-
)
|
134
|
-
|
135
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
136
|
-
if @api_client.config.debugging
|
137
|
-
@api_client.config.logger.debug "API called: UnavailabilitiesApi#deleted_unavailability_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
138
|
-
end
|
139
|
-
return data, status_code, headers
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
@@ -1,82 +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 'cgi'
|
14
|
-
|
15
|
-
module GetAroundOwner
|
16
|
-
class UsersApi
|
17
|
-
attr_accessor :api_client
|
18
|
-
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
-
@api_client = api_client
|
21
|
-
end
|
22
|
-
# User updated his profile information
|
23
|
-
# @param [Hash] opts the optional parameters
|
24
|
-
# @option opts [GetaroundUsersUpdated] :getaround_users_updated This event is triggered when a user updates his profile information (You will only receive this event on users with a booked rental or a started rental).
|
25
|
-
# @return [nil]
|
26
|
-
def updated_user_post(opts = {})
|
27
|
-
updated_user_post_with_http_info(opts)
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
# User updated his profile information
|
32
|
-
# @param [Hash] opts the optional parameters
|
33
|
-
# @option opts [GetaroundUsersUpdated] :getaround_users_updated This event is triggered when a user updates his profile information (You will only receive this event on users with a booked rental or a started rental).
|
34
|
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
35
|
-
def updated_user_post_with_http_info(opts = {})
|
36
|
-
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API: UsersApi.updated_user_post ...'
|
38
|
-
end
|
39
|
-
# resource path
|
40
|
-
local_var_path = '/updatedUser'
|
41
|
-
|
42
|
-
# query parameters
|
43
|
-
query_params = opts[:query_params] || {}
|
44
|
-
|
45
|
-
# header parameters
|
46
|
-
header_params = opts[:header_params] || {}
|
47
|
-
# HTTP header 'Content-Type'
|
48
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
49
|
-
if !content_type.nil?
|
50
|
-
header_params['Content-Type'] = content_type
|
51
|
-
end
|
52
|
-
|
53
|
-
# form parameters
|
54
|
-
form_params = opts[:form_params] || {}
|
55
|
-
|
56
|
-
# http body (model)
|
57
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'getaround_users_updated'])
|
58
|
-
|
59
|
-
# return_type
|
60
|
-
return_type = opts[:debug_return_type]
|
61
|
-
|
62
|
-
# auth_names
|
63
|
-
auth_names = opts[:debug_auth_names] || []
|
64
|
-
|
65
|
-
new_options = opts.merge(
|
66
|
-
:operation => :"UsersApi.updated_user_post",
|
67
|
-
:header_params => header_params,
|
68
|
-
:query_params => query_params,
|
69
|
-
:form_params => form_params,
|
70
|
-
:body => post_body,
|
71
|
-
:auth_names => auth_names,
|
72
|
-
:return_type => return_type
|
73
|
-
)
|
74
|
-
|
75
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
76
|
-
if @api_client.config.debugging
|
77
|
-
@api_client.config.logger.debug "API called: UsersApi#updated_user_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
-
end
|
79
|
-
return data, status_code, headers
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|