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,21 +1,19 @@
|
|
1
1
|
=begin
|
2
2
|
#Getaround Owner API
|
3
3
|
|
4
|
-
## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON:
|
4
|
+
## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
|
5
5
|
|
6
|
-
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
7
|
Contact: owner-api@getaround.com
|
8
|
-
Generated by: https://
|
9
|
-
|
10
|
-
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.66
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
14
|
-
require 'time'
|
15
13
|
|
16
14
|
module GetAroundOwner
|
17
15
|
# A Rental.
|
18
|
-
class
|
16
|
+
class Rental
|
19
17
|
# Rental's id
|
20
18
|
attr_accessor :id
|
21
19
|
|
@@ -54,22 +52,17 @@ module GetAroundOwner
|
|
54
52
|
}
|
55
53
|
end
|
56
54
|
|
57
|
-
# Returns all the JSON keys this model knows about
|
58
|
-
def self.acceptable_attributes
|
59
|
-
attribute_map.values
|
60
|
-
end
|
61
|
-
|
62
55
|
# Attribute type mapping.
|
63
56
|
def self.openapi_types
|
64
57
|
{
|
65
|
-
:'id' => :'
|
66
|
-
:'car_id' => :'
|
67
|
-
:'user_id' => :'
|
68
|
-
:'starts_at' => :'
|
69
|
-
:'ends_at' => :'
|
70
|
-
:'booked_at' => :'
|
71
|
-
:'price' => :'
|
72
|
-
:'insurance_fee' => :'
|
58
|
+
:'id' => :'Object',
|
59
|
+
:'car_id' => :'Object',
|
60
|
+
:'user_id' => :'Object',
|
61
|
+
:'starts_at' => :'Object',
|
62
|
+
:'ends_at' => :'Object',
|
63
|
+
:'booked_at' => :'Object',
|
64
|
+
:'price' => :'Object',
|
65
|
+
:'insurance_fee' => :'Object'
|
73
66
|
}
|
74
67
|
end
|
75
68
|
|
@@ -78,75 +71,58 @@ module GetAroundOwner
|
|
78
71
|
Set.new([
|
79
72
|
])
|
80
73
|
end
|
81
|
-
|
74
|
+
|
82
75
|
# Initializes the object
|
83
76
|
# @param [Hash] attributes Model attributes in the form of hash
|
84
77
|
def initialize(attributes = {})
|
85
78
|
if (!attributes.is_a?(Hash))
|
86
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::
|
79
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::Rental` initialize method"
|
87
80
|
end
|
88
81
|
|
89
82
|
# check to see if the attribute exists and convert string to symbol for hash key
|
90
83
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
91
84
|
if (!self.class.attribute_map.key?(k.to_sym))
|
92
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::
|
85
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::Rental`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
93
86
|
end
|
94
87
|
h[k.to_sym] = v
|
95
88
|
}
|
96
89
|
|
97
90
|
if attributes.key?(:'id')
|
98
91
|
self.id = attributes[:'id']
|
99
|
-
else
|
100
|
-
self.id = nil
|
101
92
|
end
|
102
93
|
|
103
94
|
if attributes.key?(:'car_id')
|
104
95
|
self.car_id = attributes[:'car_id']
|
105
|
-
else
|
106
|
-
self.car_id = nil
|
107
96
|
end
|
108
97
|
|
109
98
|
if attributes.key?(:'user_id')
|
110
99
|
self.user_id = attributes[:'user_id']
|
111
|
-
else
|
112
|
-
self.user_id = nil
|
113
100
|
end
|
114
101
|
|
115
102
|
if attributes.key?(:'starts_at')
|
116
103
|
self.starts_at = attributes[:'starts_at']
|
117
|
-
else
|
118
|
-
self.starts_at = nil
|
119
104
|
end
|
120
105
|
|
121
106
|
if attributes.key?(:'ends_at')
|
122
107
|
self.ends_at = attributes[:'ends_at']
|
123
|
-
else
|
124
|
-
self.ends_at = nil
|
125
108
|
end
|
126
109
|
|
127
110
|
if attributes.key?(:'booked_at')
|
128
111
|
self.booked_at = attributes[:'booked_at']
|
129
|
-
else
|
130
|
-
self.booked_at = nil
|
131
112
|
end
|
132
113
|
|
133
114
|
if attributes.key?(:'price')
|
134
115
|
self.price = attributes[:'price']
|
135
|
-
else
|
136
|
-
self.price = nil
|
137
116
|
end
|
138
117
|
|
139
118
|
if attributes.key?(:'insurance_fee')
|
140
119
|
self.insurance_fee = attributes[:'insurance_fee']
|
141
|
-
else
|
142
|
-
self.insurance_fee = nil
|
143
120
|
end
|
144
121
|
end
|
145
122
|
|
146
123
|
# Show invalid properties with the reasons. Usually used together with valid?
|
147
124
|
# @return Array for valid properties with the reasons
|
148
125
|
def list_invalid_properties
|
149
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
150
126
|
invalid_properties = Array.new
|
151
127
|
if @id.nil?
|
152
128
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -156,18 +132,10 @@ module GetAroundOwner
|
|
156
132
|
invalid_properties.push('invalid value for "car_id", car_id cannot be nil.')
|
157
133
|
end
|
158
134
|
|
159
|
-
if @car_id < 1
|
160
|
-
invalid_properties.push('invalid value for "car_id", must be greater than or equal to 1.')
|
161
|
-
end
|
162
|
-
|
163
135
|
if @user_id.nil?
|
164
136
|
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
165
137
|
end
|
166
138
|
|
167
|
-
if @user_id < 1
|
168
|
-
invalid_properties.push('invalid value for "user_id", must be greater than or equal to 1.')
|
169
|
-
end
|
170
|
-
|
171
139
|
if @starts_at.nil?
|
172
140
|
invalid_properties.push('invalid value for "starts_at", starts_at cannot be nil.')
|
173
141
|
end
|
@@ -194,12 +162,9 @@ module GetAroundOwner
|
|
194
162
|
# Check to see if the all the properties in the model are valid
|
195
163
|
# @return true if the model is valid
|
196
164
|
def valid?
|
197
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
198
165
|
return false if @id.nil?
|
199
166
|
return false if @car_id.nil?
|
200
|
-
return false if @car_id < 1
|
201
167
|
return false if @user_id.nil?
|
202
|
-
return false if @user_id < 1
|
203
168
|
return false if @starts_at.nil?
|
204
169
|
return false if @ends_at.nil?
|
205
170
|
return false if @booked_at.nil?
|
@@ -208,34 +173,6 @@ module GetAroundOwner
|
|
208
173
|
true
|
209
174
|
end
|
210
175
|
|
211
|
-
# Custom attribute writer method with validation
|
212
|
-
# @param [Object] car_id Value to be assigned
|
213
|
-
def car_id=(car_id)
|
214
|
-
if car_id.nil?
|
215
|
-
fail ArgumentError, 'car_id cannot be nil'
|
216
|
-
end
|
217
|
-
|
218
|
-
if car_id < 1
|
219
|
-
fail ArgumentError, 'invalid value for "car_id", must be greater than or equal to 1.'
|
220
|
-
end
|
221
|
-
|
222
|
-
@car_id = car_id
|
223
|
-
end
|
224
|
-
|
225
|
-
# Custom attribute writer method with validation
|
226
|
-
# @param [Object] user_id Value to be assigned
|
227
|
-
def user_id=(user_id)
|
228
|
-
if user_id.nil?
|
229
|
-
fail ArgumentError, 'user_id cannot be nil'
|
230
|
-
end
|
231
|
-
|
232
|
-
if user_id < 1
|
233
|
-
fail ArgumentError, 'invalid value for "user_id", must be greater than or equal to 1.'
|
234
|
-
end
|
235
|
-
|
236
|
-
@user_id = user_id
|
237
|
-
end
|
238
|
-
|
239
176
|
# Checks equality by comparing each attribute.
|
240
177
|
# @param [Object] Object to be compared
|
241
178
|
def ==(o)
|
@@ -267,33 +204,39 @@ module GetAroundOwner
|
|
267
204
|
# @param [Hash] attributes Model attributes in the form of hash
|
268
205
|
# @return [Object] Returns the model itself
|
269
206
|
def self.build_from_hash(attributes)
|
207
|
+
new.build_from_hash(attributes)
|
208
|
+
end
|
209
|
+
|
210
|
+
# Builds the object from hash
|
211
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
212
|
+
# @return [Object] Returns the model itself
|
213
|
+
def build_from_hash(attributes)
|
270
214
|
return nil unless attributes.is_a?(Hash)
|
271
|
-
|
272
|
-
|
273
|
-
openapi_types.each_pair do |key, type|
|
274
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
275
|
-
transformed_hash["#{key}"] = nil
|
276
|
-
elsif type =~ /\AArray<(.*)>/i
|
215
|
+
self.class.openapi_types.each_pair do |key, type|
|
216
|
+
if type =~ /\AArray<(.*)>/i
|
277
217
|
# check to ensure the input is an array given that the attribute
|
278
218
|
# is documented as an array but the input is not
|
279
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
280
|
-
|
219
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
220
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
281
221
|
end
|
282
|
-
elsif !attributes[attribute_map[key]].nil?
|
283
|
-
|
222
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
223
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
224
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
225
|
+
self.send("#{key}=", nil)
|
284
226
|
end
|
285
227
|
end
|
286
|
-
|
228
|
+
|
229
|
+
self
|
287
230
|
end
|
288
231
|
|
289
232
|
# Deserializes the data based on type
|
290
233
|
# @param string type Data type
|
291
234
|
# @param string value Value to be deserialized
|
292
235
|
# @return [Object] Deserialized data
|
293
|
-
def
|
236
|
+
def _deserialize(type, value)
|
294
237
|
case type.to_sym
|
295
|
-
when :
|
296
|
-
|
238
|
+
when :DateTime
|
239
|
+
DateTime.parse(value)
|
297
240
|
when :Date
|
298
241
|
Date.parse(value)
|
299
242
|
when :String
|
@@ -323,9 +266,7 @@ module GetAroundOwner
|
|
323
266
|
end
|
324
267
|
end
|
325
268
|
else # model
|
326
|
-
|
327
|
-
klass = GetAroundOwner.const_get(type)
|
328
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
269
|
+
GetAroundOwner.const_get(type).build_from_hash(value)
|
329
270
|
end
|
330
271
|
end
|
331
272
|
|
@@ -373,8 +314,5 @@ module GetAroundOwner
|
|
373
314
|
else
|
374
315
|
value
|
375
316
|
end
|
376
|
-
end
|
377
|
-
|
378
|
-
end
|
379
|
-
|
317
|
+
end end
|
380
318
|
end
|
@@ -1,20 +1,18 @@
|
|
1
1
|
=begin
|
2
2
|
#Getaround Owner API
|
3
3
|
|
4
|
-
## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON:
|
4
|
+
## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
|
5
5
|
|
6
|
-
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
7
|
Contact: owner-api@getaround.com
|
8
|
-
Generated by: https://
|
9
|
-
|
10
|
-
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.66
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
14
|
-
require 'time'
|
15
13
|
|
16
14
|
module GetAroundOwner
|
17
|
-
class
|
15
|
+
class RentalIdMessagesJsonBody
|
18
16
|
# Content of the message (2000 characters max)
|
19
17
|
attr_accessor :content
|
20
18
|
|
@@ -25,15 +23,10 @@ module GetAroundOwner
|
|
25
23
|
}
|
26
24
|
end
|
27
25
|
|
28
|
-
# Returns all the JSON keys this model knows about
|
29
|
-
def self.acceptable_attributes
|
30
|
-
attribute_map.values
|
31
|
-
end
|
32
|
-
|
33
26
|
# Attribute type mapping.
|
34
27
|
def self.openapi_types
|
35
28
|
{
|
36
|
-
:'content' => :'
|
29
|
+
:'content' => :'Object'
|
37
30
|
}
|
38
31
|
end
|
39
32
|
|
@@ -42,33 +35,30 @@ module GetAroundOwner
|
|
42
35
|
Set.new([
|
43
36
|
])
|
44
37
|
end
|
45
|
-
|
38
|
+
|
46
39
|
# Initializes the object
|
47
40
|
# @param [Hash] attributes Model attributes in the form of hash
|
48
41
|
def initialize(attributes = {})
|
49
42
|
if (!attributes.is_a?(Hash))
|
50
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::RentalIdMessagesJsonBody` initialize method"
|
51
44
|
end
|
52
45
|
|
53
46
|
# check to see if the attribute exists and convert string to symbol for hash key
|
54
47
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
48
|
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::
|
49
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::RentalIdMessagesJsonBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
50
|
end
|
58
51
|
h[k.to_sym] = v
|
59
52
|
}
|
60
53
|
|
61
54
|
if attributes.key?(:'content')
|
62
55
|
self.content = attributes[:'content']
|
63
|
-
else
|
64
|
-
self.content = nil
|
65
56
|
end
|
66
57
|
end
|
67
58
|
|
68
59
|
# Show invalid properties with the reasons. Usually used together with valid?
|
69
60
|
# @return Array for valid properties with the reasons
|
70
61
|
def list_invalid_properties
|
71
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
72
62
|
invalid_properties = Array.new
|
73
63
|
if @content.nil?
|
74
64
|
invalid_properties.push('invalid value for "content", content cannot be nil.')
|
@@ -80,7 +70,6 @@ module GetAroundOwner
|
|
80
70
|
# Check to see if the all the properties in the model are valid
|
81
71
|
# @return true if the model is valid
|
82
72
|
def valid?
|
83
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
84
73
|
return false if @content.nil?
|
85
74
|
true
|
86
75
|
end
|
@@ -109,33 +98,39 @@ module GetAroundOwner
|
|
109
98
|
# @param [Hash] attributes Model attributes in the form of hash
|
110
99
|
# @return [Object] Returns the model itself
|
111
100
|
def self.build_from_hash(attributes)
|
101
|
+
new.build_from_hash(attributes)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def build_from_hash(attributes)
|
112
108
|
return nil unless attributes.is_a?(Hash)
|
113
|
-
|
114
|
-
|
115
|
-
openapi_types.each_pair do |key, type|
|
116
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
117
|
-
transformed_hash["#{key}"] = nil
|
118
|
-
elsif type =~ /\AArray<(.*)>/i
|
109
|
+
self.class.openapi_types.each_pair do |key, type|
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
119
111
|
# check to ensure the input is an array given that the attribute
|
120
112
|
# is documented as an array but the input is not
|
121
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
122
|
-
|
113
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
115
|
end
|
124
|
-
elsif !attributes[attribute_map[key]].nil?
|
125
|
-
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
119
|
+
self.send("#{key}=", nil)
|
126
120
|
end
|
127
121
|
end
|
128
|
-
|
122
|
+
|
123
|
+
self
|
129
124
|
end
|
130
125
|
|
131
126
|
# Deserializes the data based on type
|
132
127
|
# @param string type Data type
|
133
128
|
# @param string value Value to be deserialized
|
134
129
|
# @return [Object] Deserialized data
|
135
|
-
def
|
130
|
+
def _deserialize(type, value)
|
136
131
|
case type.to_sym
|
137
|
-
when :
|
138
|
-
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
139
134
|
when :Date
|
140
135
|
Date.parse(value)
|
141
136
|
when :String
|
@@ -165,9 +160,7 @@ module GetAroundOwner
|
|
165
160
|
end
|
166
161
|
end
|
167
162
|
else # model
|
168
|
-
|
169
|
-
klass = GetAroundOwner.const_get(type)
|
170
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
GetAroundOwner.const_get(type).build_from_hash(value)
|
171
164
|
end
|
172
165
|
end
|
173
166
|
|
@@ -215,8 +208,5 @@ module GetAroundOwner
|
|
215
208
|
else
|
216
209
|
value
|
217
210
|
end
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
211
|
+
end end
|
222
212
|
end
|