get_around_owner 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -78
  3. data/docs/CarsApi.md +22 -23
  4. data/docs/CheckinsApi.md +24 -25
  5. data/docs/CheckoutsApi.md +24 -25
  6. data/docs/InvoicesApi.md +36 -37
  7. data/docs/MessagesApi.md +32 -33
  8. data/docs/PayoutsApi.md +24 -25
  9. data/docs/RentalsApi.md +24 -25
  10. data/docs/UnavailabilitiesApi.md +36 -37
  11. data/docs/UsersApi.md +11 -12
  12. data/get_around_owner-1.0.3.gem +0 -0
  13. data/get_around_owner-1.0.4.gem +0 -0
  14. data/get_around_owner.gemspec +1 -1
  15. data/getaround-api.gemspec +3 -3
  16. data/lib/{getaround-api → get_around_owner}/configuration.rb +2 -2
  17. data/lib/{getaround-api → get_around_owner}/version.rb +1 -1
  18. data/lib/{getaround-api.rb → get_around_owner.rb} +48 -48
  19. data/spec/spec_helper.rb +2 -2
  20. metadata +51 -49
  21. /data/lib/{getaround-api → get_around_owner}/api/cars_api.rb +0 -0
  22. /data/lib/{getaround-api → get_around_owner}/api/checkins_api.rb +0 -0
  23. /data/lib/{getaround-api → get_around_owner}/api/checkouts_api.rb +0 -0
  24. /data/lib/{getaround-api → get_around_owner}/api/invoices_api.rb +0 -0
  25. /data/lib/{getaround-api → get_around_owner}/api/messages_api.rb +0 -0
  26. /data/lib/{getaround-api → get_around_owner}/api/payouts_api.rb +0 -0
  27. /data/lib/{getaround-api → get_around_owner}/api/rentals_api.rb +0 -0
  28. /data/lib/{getaround-api → get_around_owner}/api/unavailabilities_api.rb +0 -0
  29. /data/lib/{getaround-api → get_around_owner}/api/users_api.rb +0 -0
  30. /data/lib/{getaround-api → get_around_owner}/api_client.rb +0 -0
  31. /data/lib/{getaround-api → get_around_owner}/api_error.rb +0 -0
  32. /data/lib/{getaround-api → get_around_owner}/models/car.rb +0 -0
  33. /data/lib/{getaround-api → get_around_owner}/models/car_id.rb +0 -0
  34. /data/lib/{getaround-api → get_around_owner}/models/car_id_unavailabilities_json_body.rb +0 -0
  35. /data/lib/{getaround-api → get_around_owner}/models/cars_index.rb +0 -0
  36. /data/lib/{getaround-api → get_around_owner}/models/checkin.rb +0 -0
  37. /data/lib/{getaround-api → get_around_owner}/models/checkins_index.rb +0 -0
  38. /data/lib/{getaround-api → get_around_owner}/models/checkout.rb +0 -0
  39. /data/lib/{getaround-api → get_around_owner}/models/checkouts_index.rb +0 -0
  40. /data/lib/{getaround-api → get_around_owner}/models/ends_at.rb +0 -0
  41. /data/lib/{getaround-api → get_around_owner}/models/invoice.rb +0 -0
  42. /data/lib/{getaround-api → get_around_owner}/models/invoices_index.rb +0 -0
  43. /data/lib/{getaround-api → get_around_owner}/models/message.rb +0 -0
  44. /data/lib/{getaround-api → get_around_owner}/models/messages_sent.rb +0 -0
  45. /data/lib/{getaround-api → get_around_owner}/models/payout.rb +0 -0
  46. /data/lib/{getaround-api → get_around_owner}/models/payouts_index.rb +0 -0
  47. /data/lib/{getaround-api → get_around_owner}/models/rental.rb +0 -0
  48. /data/lib/{getaround-api → get_around_owner}/models/rental_id_messages_json_body.rb +0 -0
  49. /data/lib/{getaround-api → get_around_owner}/models/rental_invoices_index.rb +0 -0
  50. /data/lib/{getaround-api → get_around_owner}/models/rental_messages_index.rb +0 -0
  51. /data/lib/{getaround-api → get_around_owner}/models/rentals_booked.rb +0 -0
  52. /data/lib/{getaround-api → get_around_owner}/models/rentals_canceled.rb +0 -0
  53. /data/lib/{getaround-api → get_around_owner}/models/rentals_car_checked_in.rb +0 -0
  54. /data/lib/{getaround-api → get_around_owner}/models/rentals_car_checked_out.rb +0 -0
  55. /data/lib/{getaround-api → get_around_owner}/models/rentals_car_switched.rb +0 -0
  56. /data/lib/{getaround-api → get_around_owner}/models/rentals_index.rb +0 -0
  57. /data/lib/{getaround-api → get_around_owner}/models/rentals_times_changed.rb +0 -0
  58. /data/lib/{getaround-api → get_around_owner}/models/starts_at.rb +0 -0
  59. /data/lib/{getaround-api → get_around_owner}/models/unavailabilities_created.rb +0 -0
  60. /data/lib/{getaround-api → get_around_owner}/models/unavailabilities_deleted.rb +0 -0
  61. /data/lib/{getaround-api → get_around_owner}/models/unavailabilities_index.rb +0 -0
  62. /data/lib/{getaround-api → get_around_owner}/models/unavailability.rb +0 -0
  63. /data/lib/{getaround-api → get_around_owner}/models/user.rb +0 -0
  64. /data/lib/{getaround-api → get_around_owner}/models/users_updated.rb +0 -0
  65. /data/lib/{getaround-api → get_around_owner}/models/webhook.rb +0 -0
@@ -2,13 +2,14 @@
2
2
 
3
3
  All URIs are relative to *https://api-eu.getaround.com/owner/v1*
4
4
 
5
- Method | HTTP request | Description
6
- ------------- | ------------- | -------------
7
- [**create_unavailabilities**](UnavailabilitiesApi.md#create_unavailabilities) | **POST** /cars/{car_id}/unavailabilities.json | Create Unavailability related to a car between dates
8
- [**destroy_unavailability**](UnavailabilitiesApi.md#destroy_unavailability) | **DELETE** /cars/{car_id}/unavailabilities.json | Destroy Unavailability related to a car between dates
9
- [**get_unavailabilities_for_car**](UnavailabilitiesApi.md#get_unavailabilities_for_car) | **GET** /cars/{car_id}/unavailabilities.json | Find Unavailabilities related to a car between dates
5
+ | Method | HTTP request | Description |
6
+ | --------------------------------------------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------------- |
7
+ | [**create_unavailabilities**](UnavailabilitiesApi.md#create_unavailabilities) | **POST** /cars/{car_id}/unavailabilities.json | Create Unavailability related to a car between dates |
8
+ | [**destroy_unavailability**](UnavailabilitiesApi.md#destroy_unavailability) | **DELETE** /cars/{car_id}/unavailabilities.json | Destroy Unavailability related to a car between dates |
9
+ | [**get_unavailabilities_for_car**](UnavailabilitiesApi.md#get_unavailabilities_for_car) | **GET** /cars/{car_id}/unavailabilities.json | Find Unavailabilities related to a car between dates |
10
10
 
11
11
  # **create_unavailabilities**
12
+
12
13
  > create_unavailabilities(car_id, opts)
13
14
 
14
15
  Create Unavailability related to a car between dates
@@ -16,16 +17,17 @@ Create Unavailability related to a car between dates
16
17
  Set a car as unavailable between 2 dates
17
18
 
18
19
  ### Example
20
+
19
21
  ```ruby
20
22
  # load the gem
21
- require 'getaround-api'
23
+ require 'get_around_owner'
22
24
  # setup authorization
23
25
  GetAroundOwner.configure do |config|
24
26
  end
25
27
 
26
28
  api_instance = GetAroundOwner::UnavailabilitiesApi.new
27
29
  car_id = GetAroundOwner::null.new # | ID of car
28
- opts = {
30
+ opts = {
29
31
  body: GetAroundOwner::CarIdUnavailabilitiesJsonBody.new # CarIdUnavailabilitiesJsonBody | Unavailability to create
30
32
  }
31
33
 
@@ -39,10 +41,10 @@ end
39
41
 
40
42
  ### Parameters
41
43
 
42
- Name | Type | Description | Notes
43
- ------------- | ------------- | ------------- | -------------
44
- **car_id** | [****](.md)| ID of car |
45
- **body** | [**CarIdUnavailabilitiesJsonBody**](CarIdUnavailabilitiesJsonBody.md)| Unavailability to create | [optional]
44
+ | Name | Type | Description | Notes |
45
+ | ---------- | --------------------------------------------------------------------- | ------------------------ | ---------- |
46
+ | **car_id** | [\*\*\*\*](.md) | ID of car |
47
+ | **body** | [**CarIdUnavailabilitiesJsonBody**](CarIdUnavailabilitiesJsonBody.md) | Unavailability to create | [optional] |
46
48
 
47
49
  ### Return type
48
50
 
@@ -54,12 +56,11 @@ nil (empty response body)
54
56
 
55
57
  ### HTTP request headers
56
58
 
57
- - **Content-Type**: application/json
58
- - **Accept**: Not defined
59
-
60
-
59
+ - **Content-Type**: application/json
60
+ - **Accept**: Not defined
61
61
 
62
62
  # **destroy_unavailability**
63
+
63
64
  > destroy_unavailability(car_id)
64
65
 
65
66
  Destroy Unavailability related to a car between dates
@@ -67,9 +68,10 @@ Destroy Unavailability related to a car between dates
67
68
  Set a car as available between 2 dates
68
69
 
69
70
  ### Example
71
+
70
72
  ```ruby
71
73
  # load the gem
72
- require 'getaround-api'
74
+ require 'get_around_owner'
73
75
  # setup authorization
74
76
  GetAroundOwner.configure do |config|
75
77
  end
@@ -88,9 +90,9 @@ end
88
90
 
89
91
  ### Parameters
90
92
 
91
- Name | Type | Description | Notes
92
- ------------- | ------------- | ------------- | -------------
93
- **car_id** | [****](.md)| ID of car |
93
+ | Name | Type | Description | Notes |
94
+ | ---------- | --------------- | ----------- | ----- |
95
+ | **car_id** | [\*\*\*\*](.md) | ID of car |
94
96
 
95
97
  ### Return type
96
98
 
@@ -102,12 +104,11 @@ nil (empty response body)
102
104
 
103
105
  ### HTTP request headers
104
106
 
105
- - **Content-Type**: Not defined
106
- - **Accept**: Not defined
107
-
108
-
107
+ - **Content-Type**: Not defined
108
+ - **Accept**: Not defined
109
109
 
110
110
  # **get_unavailabilities_for_car**
111
+
111
112
  > UnavailabilitiesIndex get_unavailabilities_for_car(start_date, end_date, car_id, opts)
112
113
 
113
114
  Find Unavailabilities related to a car between dates
@@ -115,9 +116,10 @@ Find Unavailabilities related to a car between dates
115
116
  Find between 2 dates when you’ve set a car as unavailable
116
117
 
117
118
  ### Example
119
+
118
120
  ```ruby
119
121
  # load the gem
120
- require 'getaround-api'
122
+ require 'get_around_owner'
121
123
  # setup authorization
122
124
  GetAroundOwner.configure do |config|
123
125
  end
@@ -126,7 +128,7 @@ api_instance = GetAroundOwner::UnavailabilitiesApi.new
126
128
  start_date = GetAroundOwner::null.new # | Start date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html)
127
129
  end_date = GetAroundOwner::null.new # | End date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html)
128
130
  car_id = GetAroundOwner::null.new # | ID of the car
129
- opts = {
131
+ opts = {
130
132
  page: GetAroundOwner::null.new, # | Page number
131
133
  per_page: GetAroundOwner::null.new # | Page size
132
134
  }
@@ -142,13 +144,13 @@ end
142
144
 
143
145
  ### Parameters
144
146
 
145
- Name | Type | Description | Notes
146
- ------------- | ------------- | ------------- | -------------
147
- **start_date** | [****](.md)| Start date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html) |
148
- **end_date** | [****](.md)| End date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html) |
149
- **car_id** | [****](.md)| ID of the car |
150
- **page** | [****](.md)| Page number | [optional]
151
- **per_page** | [****](.md)| Page size | [optional] [default to 30]
147
+ | Name | Type | Description | Notes |
148
+ | -------------- | --------------- | ----------------------------------------------------------------------------------------------- | -------------------------- |
149
+ | **start_date** | [\*\*\*\*](.md) | Start date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html) |
150
+ | **end_date** | [\*\*\*\*](.md) | End date and time in [ISO8601 format](https://www.iso.org/iso-8601-date-and-time-format.html) |
151
+ | **car_id** | [\*\*\*\*](.md) | ID of the car |
152
+ | **page** | [\*\*\*\*](.md) | Page number | [optional] |
153
+ | **per_page** | [\*\*\*\*](.md) | Page size | [optional] [default to 30] |
152
154
 
153
155
  ### Return type
154
156
 
@@ -160,8 +162,5 @@ Name | Type | Description | Notes
160
162
 
161
163
  ### HTTP request headers
162
164
 
163
- - **Content-Type**: Not defined
164
- - **Accept**: application/json
165
-
166
-
167
-
165
+ - **Content-Type**: Not defined
166
+ - **Accept**: application/json
data/docs/UsersApi.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  All URIs are relative to *https://api-eu.getaround.com/owner/v1*
4
4
 
5
- Method | HTTP request | Description
6
- ------------- | ------------- | -------------
7
- [**get_user_by_id**](UsersApi.md#get_user_by_id) | **GET** /users/{id}.json | Find a user by ID (Users are customers who rent one of your cars)
5
+ | Method | HTTP request | Description |
6
+ | ------------------------------------------------ | ------------------------ | ----------------------------------------------------------------- |
7
+ | [**get_user_by_id**](UsersApi.md#get_user_by_id) | **GET** /users/{id}.json | Find a user by ID (Users are customers who rent one of your cars) |
8
8
 
9
9
  # **get_user_by_id**
10
+
10
11
  > User get_user_by_id(id)
11
12
 
12
13
  Find a user by ID (Users are customers who rent one of your cars)
@@ -14,9 +15,10 @@ Find a user by ID (Users are customers who rent one of your cars)
14
15
  Find a user by ID (Users are customers who rent one of your cars)
15
16
 
16
17
  ### Example
18
+
17
19
  ```ruby
18
20
  # load the gem
19
- require 'getaround-api'
21
+ require 'get_around_owner'
20
22
  # setup authorization
21
23
  GetAroundOwner.configure do |config|
22
24
  end
@@ -36,9 +38,9 @@ end
36
38
 
37
39
  ### Parameters
38
40
 
39
- Name | Type | Description | Notes
40
- ------------- | ------------- | ------------- | -------------
41
- **id** | [****](.md)| ID of user to return |
41
+ | Name | Type | Description | Notes |
42
+ | ------ | --------------- | -------------------- | ----- |
43
+ | **id** | [\*\*\*\*](.md) | ID of user to return |
42
44
 
43
45
  ### Return type
44
46
 
@@ -50,8 +52,5 @@ Name | Type | Description | Notes
50
52
 
51
53
  ### HTTP request headers
52
54
 
53
- - **Content-Type**: Not defined
54
- - **Accept**: application/json
55
-
56
-
57
-
55
+ - **Content-Type**: Not defined
56
+ - **Accept**: application/json
Binary file
Binary file
@@ -13,7 +13,7 @@ Generator version: 7.10.0
13
13
  =end
14
14
 
15
15
  $:.push File.expand_path("../lib", __FILE__)
16
- require "getaround-api/version"
16
+ require "get_around_owner/version"
17
17
 
18
18
  Gem::Specification.new do |s|
19
19
  s.name = "get_around_owner"
@@ -3,7 +3,7 @@
3
3
  =begin
4
4
  #Getaround Owner API
5
5
 
6
- ## 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.
6
+ ## 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.
7
7
 
8
8
  OpenAPI spec version: 1.0.0
9
9
  Contact: owner-api@getaround.com
@@ -12,10 +12,10 @@ Swagger Codegen version: 3.0.66
12
12
  =end
13
13
 
14
14
  $:.push File.expand_path("../lib", __FILE__)
15
- require "getaround-api/version"
15
+ require "get_around_owner/version"
16
16
 
17
17
  Gem::Specification.new do |s|
18
- s.name = "getaround-api"
18
+ s.name = "get_around_owner"
19
19
  s.version = GetAroundOwner::VERSION
20
20
  s.platform = Gem::Platform::RUBY
21
21
  s.authors = ["YannPETITJEAN"]
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
@@ -127,7 +127,7 @@ module GetAroundOwner
127
127
  def initialize
128
128
  @scheme = 'https'
129
129
  @host = 'api-eu.getaround.com'
130
- @base_path = 'https://api-eu.getaround.com/owner/v1'
130
+ @base_path = '/owner/v1'
131
131
  @api_key = {}
132
132
  @api_key_prefix = {}
133
133
  @timeout = 0
@@ -10,5 +10,5 @@ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  module GetAroundOwner
13
- VERSION = '1.0.3'
13
+ VERSION = '1.0.5'
14
14
  end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
@@ -10,57 +10,57 @@ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  # Common files
13
- require 'getaround-api/api_client'
14
- require 'getaround-api/api_error'
15
- require 'getaround-api/version'
16
- require 'getaround-api/configuration'
13
+ require 'get_around_owner/api_client'
14
+ require 'get_around_owner/api_error'
15
+ require 'get_around_owner/version'
16
+ require 'get_around_owner/configuration'
17
17
 
18
18
  # Models
19
- require 'getaround-api/models/car'
20
- require 'getaround-api/models/car_id'
21
- require 'getaround-api/models/car_id_unavailabilities_json_body'
22
- require 'getaround-api/models/cars_index'
23
- require 'getaround-api/models/checkin'
24
- require 'getaround-api/models/checkins_index'
25
- require 'getaround-api/models/checkout'
26
- require 'getaround-api/models/checkouts_index'
27
- require 'getaround-api/models/ends_at'
28
- require 'getaround-api/models/invoice'
29
- require 'getaround-api/models/invoices_index'
30
- require 'getaround-api/models/message'
31
- require 'getaround-api/models/messages_sent'
32
- require 'getaround-api/models/payout'
33
- require 'getaround-api/models/payouts_index'
34
- require 'getaround-api/models/rental'
35
- require 'getaround-api/models/rental_id_messages_json_body'
36
- require 'getaround-api/models/rental_invoices_index'
37
- require 'getaround-api/models/rental_messages_index'
38
- require 'getaround-api/models/rentals_booked'
39
- require 'getaround-api/models/rentals_canceled'
40
- require 'getaround-api/models/rentals_car_checked_in'
41
- require 'getaround-api/models/rentals_car_checked_out'
42
- require 'getaround-api/models/rentals_car_switched'
43
- require 'getaround-api/models/rentals_index'
44
- require 'getaround-api/models/rentals_times_changed'
45
- require 'getaround-api/models/starts_at'
46
- require 'getaround-api/models/unavailabilities_created'
47
- require 'getaround-api/models/unavailabilities_deleted'
48
- require 'getaround-api/models/unavailabilities_index'
49
- require 'getaround-api/models/unavailability'
50
- require 'getaround-api/models/user'
51
- require 'getaround-api/models/users_updated'
52
- require 'getaround-api/models/webhook'
19
+ require 'get_around_owner/models/car'
20
+ require 'get_around_owner/models/car_id'
21
+ require 'get_around_owner/models/car_id_unavailabilities_json_body'
22
+ require 'get_around_owner/models/cars_index'
23
+ require 'get_around_owner/models/checkin'
24
+ require 'get_around_owner/models/checkins_index'
25
+ require 'get_around_owner/models/checkout'
26
+ require 'get_around_owner/models/checkouts_index'
27
+ require 'get_around_owner/models/ends_at'
28
+ require 'get_around_owner/models/invoice'
29
+ require 'get_around_owner/models/invoices_index'
30
+ require 'get_around_owner/models/message'
31
+ require 'get_around_owner/models/messages_sent'
32
+ require 'get_around_owner/models/payout'
33
+ require 'get_around_owner/models/payouts_index'
34
+ require 'get_around_owner/models/rental'
35
+ require 'get_around_owner/models/rental_id_messages_json_body'
36
+ require 'get_around_owner/models/rental_invoices_index'
37
+ require 'get_around_owner/models/rental_messages_index'
38
+ require 'get_around_owner/models/rentals_booked'
39
+ require 'get_around_owner/models/rentals_canceled'
40
+ require 'get_around_owner/models/rentals_car_checked_in'
41
+ require 'get_around_owner/models/rentals_car_checked_out'
42
+ require 'get_around_owner/models/rentals_car_switched'
43
+ require 'get_around_owner/models/rentals_index'
44
+ require 'get_around_owner/models/rentals_times_changed'
45
+ require 'get_around_owner/models/starts_at'
46
+ require 'get_around_owner/models/unavailabilities_created'
47
+ require 'get_around_owner/models/unavailabilities_deleted'
48
+ require 'get_around_owner/models/unavailabilities_index'
49
+ require 'get_around_owner/models/unavailability'
50
+ require 'get_around_owner/models/user'
51
+ require 'get_around_owner/models/users_updated'
52
+ require 'get_around_owner/models/webhook'
53
53
 
54
54
  # APIs
55
- require 'getaround-api/api/cars_api'
56
- require 'getaround-api/api/checkins_api'
57
- require 'getaround-api/api/checkouts_api'
58
- require 'getaround-api/api/invoices_api'
59
- require 'getaround-api/api/messages_api'
60
- require 'getaround-api/api/payouts_api'
61
- require 'getaround-api/api/rentals_api'
62
- require 'getaround-api/api/unavailabilities_api'
63
- require 'getaround-api/api/users_api'
55
+ require 'get_around_owner/api/cars_api'
56
+ require 'get_around_owner/api/checkins_api'
57
+ require 'get_around_owner/api/checkouts_api'
58
+ require 'get_around_owner/api/invoices_api'
59
+ require 'get_around_owner/api/messages_api'
60
+ require 'get_around_owner/api/payouts_api'
61
+ require 'get_around_owner/api/rentals_api'
62
+ require 'get_around_owner/api/unavailabilities_api'
63
+ require 'get_around_owner/api/users_api'
64
64
 
65
65
  module GetAroundOwner
66
66
  class << self
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Getaround Owner API
3
3
 
4
- ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: #{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
7
  Contact: owner-api@getaround.com
@@ -10,7 +10,7 @@ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  # load the gem
13
- require 'getaround-api'
13
+ require 'get_around_owner'
14
14
 
15
15
  # The following was generated by the `rspec --init` command. Conventionally, all
16
16
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.