get_around_owner 1.0.0

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 (154) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +303 -0
  4. data/Rakefile +10 -0
  5. data/docs/CarsApi.md +151 -0
  6. data/docs/CheckinsApi.md +71 -0
  7. data/docs/CheckoutsApi.md +71 -0
  8. data/docs/GetaroundCar.md +28 -0
  9. data/docs/GetaroundCarsIndexInner.md +18 -0
  10. data/docs/GetaroundCheckin.md +24 -0
  11. data/docs/GetaroundCheckinsIndexInner.md +18 -0
  12. data/docs/GetaroundCheckout.md +26 -0
  13. data/docs/GetaroundCreateMessagesRequest.md +18 -0
  14. data/docs/GetaroundCreateUnavailabilitiesRequest.md +22 -0
  15. data/docs/GetaroundDestroyUnavailabilityRequest.md +20 -0
  16. data/docs/GetaroundInvoice.md +34 -0
  17. data/docs/GetaroundInvoiceChargesInner.md +20 -0
  18. data/docs/GetaroundInvoicesIndexInner.md +18 -0
  19. data/docs/GetaroundMessage.md +26 -0
  20. data/docs/GetaroundMessagesSent.md +22 -0
  21. data/docs/GetaroundMessagesSentAllOfData.md +20 -0
  22. data/docs/GetaroundPayout.md +28 -0
  23. data/docs/GetaroundPayoutInvoicesInner.md +18 -0
  24. data/docs/GetaroundPayoutsIndexInner.md +18 -0
  25. data/docs/GetaroundReason.md +15 -0
  26. data/docs/GetaroundRental.md +32 -0
  27. data/docs/GetaroundRentalInvoicesIndexInner.md +18 -0
  28. data/docs/GetaroundRentalMessagesIndexInner.md +18 -0
  29. data/docs/GetaroundRentalsBooked.md +22 -0
  30. data/docs/GetaroundRentalsBookedAllOfData.md +18 -0
  31. data/docs/GetaroundRentalsCanceled.md +22 -0
  32. data/docs/GetaroundRentalsCarCheckedIn.md +22 -0
  33. data/docs/GetaroundRentalsCarCheckedOut.md +22 -0
  34. data/docs/GetaroundRentalsCarSwitched.md +22 -0
  35. data/docs/GetaroundRentalsIndexInner.md +18 -0
  36. data/docs/GetaroundRentalsTimesChanged.md +22 -0
  37. data/docs/GetaroundUnavailabilitiesCreated.md +22 -0
  38. data/docs/GetaroundUnavailabilitiesCreatedAllOfData.md +24 -0
  39. data/docs/GetaroundUnavailabilitiesDeleted.md +22 -0
  40. data/docs/GetaroundUnavailabilitiesDeletedAllOfData.md +22 -0
  41. data/docs/GetaroundUnavailability.md +24 -0
  42. data/docs/GetaroundUser.md +42 -0
  43. data/docs/GetaroundUsersUpdated.md +22 -0
  44. data/docs/GetaroundUsersUpdatedAllOfData.md +18 -0
  45. data/docs/GetaroundWebhook.md +22 -0
  46. data/docs/InvoicesApi.md +231 -0
  47. data/docs/MessagesApi.md +71 -0
  48. data/docs/PayoutsApi.md +155 -0
  49. data/docs/RentalsApi.md +263 -0
  50. data/docs/UnavailabilitiesApi.md +135 -0
  51. data/docs/UsersApi.md +71 -0
  52. data/get_around_owner.gemspec +26 -0
  53. data/git_push.sh +57 -0
  54. data/lib/get_around_owner/api/cars_api.rb +148 -0
  55. data/lib/get_around_owner/api/checkins_api.rb +82 -0
  56. data/lib/get_around_owner/api/checkouts_api.rb +82 -0
  57. data/lib/get_around_owner/api/invoices_api.rb +223 -0
  58. data/lib/get_around_owner/api/messages_api.rb +82 -0
  59. data/lib/get_around_owner/api/payouts_api.rb +162 -0
  60. data/lib/get_around_owner/api/rentals_api.rb +262 -0
  61. data/lib/get_around_owner/api/unavailabilities_api.rb +142 -0
  62. data/lib/get_around_owner/api/users_api.rb +82 -0
  63. data/lib/get_around_owner/api_client.rb +394 -0
  64. data/lib/get_around_owner/api_error.rb +58 -0
  65. data/lib/get_around_owner/configuration.rb +298 -0
  66. data/lib/get_around_owner/models/getaround_car.rb +308 -0
  67. data/lib/get_around_owner/models/getaround_cars_index_inner.rb +223 -0
  68. data/lib/get_around_owner/models/getaround_checkin.rb +279 -0
  69. data/lib/get_around_owner/models/getaround_checkins_index_inner.rb +222 -0
  70. data/lib/get_around_owner/models/getaround_checkout.rb +298 -0
  71. data/lib/get_around_owner/models/getaround_create_messages_request.rb +222 -0
  72. data/lib/get_around_owner/models/getaround_create_unavailabilities_request.rb +283 -0
  73. data/lib/get_around_owner/models/getaround_destroy_unavailability_request.rb +239 -0
  74. data/lib/get_around_owner/models/getaround_invoice.rb +396 -0
  75. data/lib/get_around_owner/models/getaround_invoice_charges_inner.rb +225 -0
  76. data/lib/get_around_owner/models/getaround_invoices_index_inner.rb +223 -0
  77. data/lib/get_around_owner/models/getaround_message.rb +291 -0
  78. data/lib/get_around_owner/models/getaround_messages_sent.rb +257 -0
  79. data/lib/get_around_owner/models/getaround_messages_sent_all_of_data.rb +225 -0
  80. data/lib/get_around_owner/models/getaround_payout.rb +347 -0
  81. data/lib/get_around_owner/models/getaround_payout_invoices_inner.rb +223 -0
  82. data/lib/get_around_owner/models/getaround_payouts_index_inner.rb +223 -0
  83. data/lib/get_around_owner/models/getaround_reason.rb +45 -0
  84. data/lib/get_around_owner/models/getaround_rental.rb +380 -0
  85. data/lib/get_around_owner/models/getaround_rental_invoices_index_inner.rb +223 -0
  86. data/lib/get_around_owner/models/getaround_rental_messages_index_inner.rb +223 -0
  87. data/lib/get_around_owner/models/getaround_rentals_booked.rb +257 -0
  88. data/lib/get_around_owner/models/getaround_rentals_booked_all_of_data.rb +215 -0
  89. data/lib/get_around_owner/models/getaround_rentals_canceled.rb +257 -0
  90. data/lib/get_around_owner/models/getaround_rentals_car_checked_in.rb +257 -0
  91. data/lib/get_around_owner/models/getaround_rentals_car_checked_out.rb +257 -0
  92. data/lib/get_around_owner/models/getaround_rentals_car_switched.rb +257 -0
  93. data/lib/get_around_owner/models/getaround_rentals_index_inner.rb +223 -0
  94. data/lib/get_around_owner/models/getaround_rentals_times_changed.rb +257 -0
  95. data/lib/get_around_owner/models/getaround_unavailabilities_created.rb +257 -0
  96. data/lib/get_around_owner/models/getaround_unavailabilities_created_all_of_data.rb +267 -0
  97. data/lib/get_around_owner/models/getaround_unavailabilities_deleted.rb +257 -0
  98. data/lib/get_around_owner/models/getaround_unavailabilities_deleted_all_of_data.rb +235 -0
  99. data/lib/get_around_owner/models/getaround_unavailability.rb +302 -0
  100. data/lib/get_around_owner/models/getaround_user.rb +420 -0
  101. data/lib/get_around_owner/models/getaround_users_updated.rb +257 -0
  102. data/lib/get_around_owner/models/getaround_users_updated_all_of_data.rb +215 -0
  103. data/lib/get_around_owner/models/getaround_webhook.rb +252 -0
  104. data/lib/get_around_owner/version.rb +15 -0
  105. data/lib/get_around_owner.rb +86 -0
  106. data/spec/api/cars_api_spec.rb +60 -0
  107. data/spec/api/checkins_api_spec.rb +62 -0
  108. data/spec/api/checkouts_api_spec.rb +62 -0
  109. data/spec/api/invoices_api_spec.rb +76 -0
  110. data/spec/api/messages_api_spec.rb +73 -0
  111. data/spec/api/payouts_api_spec.rb +62 -0
  112. data/spec/api/rentals_api_spec.rb +62 -0
  113. data/spec/api/unavailabilities_api_spec.rb +77 -0
  114. data/spec/api/users_api_spec.rb +47 -0
  115. data/spec/models/getaround_car_spec.rb +66 -0
  116. data/spec/models/getaround_cars_index_inner_spec.rb +36 -0
  117. data/spec/models/getaround_checkin_spec.rb +54 -0
  118. data/spec/models/getaround_checkins_index_inner_spec.rb +36 -0
  119. data/spec/models/getaround_checkout_spec.rb +60 -0
  120. data/spec/models/getaround_create_messages_request_spec.rb +36 -0
  121. data/spec/models/getaround_create_unavailabilities_request_spec.rb +52 -0
  122. data/spec/models/getaround_destroy_unavailability_request_spec.rb +42 -0
  123. data/spec/models/getaround_invoice_charges_inner_spec.rb +42 -0
  124. data/spec/models/getaround_invoice_spec.rb +92 -0
  125. data/spec/models/getaround_invoices_index_inner_spec.rb +36 -0
  126. data/spec/models/getaround_message_spec.rb +60 -0
  127. data/spec/models/getaround_messages_sent_all_of_data_spec.rb +42 -0
  128. data/spec/models/getaround_messages_sent_spec.rb +48 -0
  129. data/spec/models/getaround_payout_invoices_inner_spec.rb +36 -0
  130. data/spec/models/getaround_payout_spec.rb +70 -0
  131. data/spec/models/getaround_payouts_index_inner_spec.rb +36 -0
  132. data/spec/models/getaround_reason_spec.rb +30 -0
  133. data/spec/models/getaround_rental_invoices_index_inner_spec.rb +36 -0
  134. data/spec/models/getaround_rental_messages_index_inner_spec.rb +36 -0
  135. data/spec/models/getaround_rental_spec.rb +78 -0
  136. data/spec/models/getaround_rentals_booked_all_of_data_spec.rb +36 -0
  137. data/spec/models/getaround_rentals_booked_spec.rb +48 -0
  138. data/spec/models/getaround_rentals_canceled_spec.rb +48 -0
  139. data/spec/models/getaround_rentals_car_checked_in_spec.rb +48 -0
  140. data/spec/models/getaround_rentals_car_checked_out_spec.rb +48 -0
  141. data/spec/models/getaround_rentals_car_switched_spec.rb +48 -0
  142. data/spec/models/getaround_rentals_index_inner_spec.rb +36 -0
  143. data/spec/models/getaround_rentals_times_changed_spec.rb +48 -0
  144. data/spec/models/getaround_unavailabilities_created_all_of_data_spec.rb +54 -0
  145. data/spec/models/getaround_unavailabilities_created_spec.rb +48 -0
  146. data/spec/models/getaround_unavailabilities_deleted_all_of_data_spec.rb +48 -0
  147. data/spec/models/getaround_unavailabilities_deleted_spec.rb +48 -0
  148. data/spec/models/getaround_unavailability_spec.rb +58 -0
  149. data/spec/models/getaround_user_spec.rb +108 -0
  150. data/spec/models/getaround_users_updated_all_of_data_spec.rb +36 -0
  151. data/spec/models/getaround_users_updated_spec.rb +48 -0
  152. data/spec/models/getaround_webhook_spec.rb +48 -0
  153. data/spec/spec_helper.rb +111 -0
  154. metadata +283 -0
@@ -0,0 +1,420 @@
1
+ =begin
2
+ #Getaround Owner API
3
+
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: owner-api@getaround.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module GetAroundOwner
17
+ # A User.
18
+ class GetaroundUser
19
+ # The user ID
20
+ attr_accessor :id
21
+
22
+ # First name(s)
23
+ attr_accessor :first_name
24
+
25
+ # Last name(s)
26
+ attr_accessor :last_name
27
+
28
+ # The phone number in international format
29
+ attr_accessor :phone_number
30
+
31
+ # Residential address of the user
32
+ attr_accessor :address_line1
33
+
34
+ # Additional address details
35
+ attr_accessor :address_line2
36
+
37
+ # The postal code
38
+ attr_accessor :postal_code
39
+
40
+ # The city
41
+ attr_accessor :city
42
+
43
+ # Address's country format ISO_3166-1_alpha-2 (ex: FR, ES, ...)
44
+ attr_accessor :country
45
+
46
+ # The birth date
47
+ attr_accessor :birth_date
48
+
49
+ # Driving licence country of issue format ISO_3166-1_alpha-2 (ex: FR, ES, ...)
50
+ attr_accessor :license_country
51
+
52
+ # Driving licence first issue date
53
+ attr_accessor :license_first_issue_date
54
+
55
+ # The license number
56
+ attr_accessor :license_number
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'id' => :'id',
62
+ :'first_name' => :'first_name',
63
+ :'last_name' => :'last_name',
64
+ :'phone_number' => :'phone_number',
65
+ :'address_line1' => :'address_line1',
66
+ :'address_line2' => :'address_line2',
67
+ :'postal_code' => :'postal_code',
68
+ :'city' => :'city',
69
+ :'country' => :'country',
70
+ :'birth_date' => :'birth_date',
71
+ :'license_country' => :'license_country',
72
+ :'license_first_issue_date' => :'license_first_issue_date',
73
+ :'license_number' => :'license_number'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'id' => :'Integer',
86
+ :'first_name' => :'String',
87
+ :'last_name' => :'String',
88
+ :'phone_number' => :'String',
89
+ :'address_line1' => :'String',
90
+ :'address_line2' => :'String',
91
+ :'postal_code' => :'String',
92
+ :'city' => :'String',
93
+ :'country' => :'String',
94
+ :'birth_date' => :'Date',
95
+ :'license_country' => :'String',
96
+ :'license_first_issue_date' => :'Date',
97
+ :'license_number' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::GetaroundUser` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::GetaroundUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'id')
123
+ self.id = attributes[:'id']
124
+ else
125
+ self.id = nil
126
+ end
127
+
128
+ if attributes.key?(:'first_name')
129
+ self.first_name = attributes[:'first_name']
130
+ else
131
+ self.first_name = nil
132
+ end
133
+
134
+ if attributes.key?(:'last_name')
135
+ self.last_name = attributes[:'last_name']
136
+ else
137
+ self.last_name = nil
138
+ end
139
+
140
+ if attributes.key?(:'phone_number')
141
+ self.phone_number = attributes[:'phone_number']
142
+ else
143
+ self.phone_number = nil
144
+ end
145
+
146
+ if attributes.key?(:'address_line1')
147
+ self.address_line1 = attributes[:'address_line1']
148
+ else
149
+ self.address_line1 = nil
150
+ end
151
+
152
+ if attributes.key?(:'address_line2')
153
+ self.address_line2 = attributes[:'address_line2']
154
+ end
155
+
156
+ if attributes.key?(:'postal_code')
157
+ self.postal_code = attributes[:'postal_code']
158
+ else
159
+ self.postal_code = nil
160
+ end
161
+
162
+ if attributes.key?(:'city')
163
+ self.city = attributes[:'city']
164
+ else
165
+ self.city = nil
166
+ end
167
+
168
+ if attributes.key?(:'country')
169
+ self.country = attributes[:'country']
170
+ else
171
+ self.country = nil
172
+ end
173
+
174
+ if attributes.key?(:'birth_date')
175
+ self.birth_date = attributes[:'birth_date']
176
+ else
177
+ self.birth_date = nil
178
+ end
179
+
180
+ if attributes.key?(:'license_country')
181
+ self.license_country = attributes[:'license_country']
182
+ else
183
+ self.license_country = nil
184
+ end
185
+
186
+ if attributes.key?(:'license_first_issue_date')
187
+ self.license_first_issue_date = attributes[:'license_first_issue_date']
188
+ else
189
+ self.license_first_issue_date = nil
190
+ end
191
+
192
+ if attributes.key?(:'license_number')
193
+ self.license_number = attributes[:'license_number']
194
+ else
195
+ self.license_number = nil
196
+ end
197
+ end
198
+
199
+ # Show invalid properties with the reasons. Usually used together with valid?
200
+ # @return Array for valid properties with the reasons
201
+ def list_invalid_properties
202
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
203
+ invalid_properties = Array.new
204
+ if @id.nil?
205
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
206
+ end
207
+
208
+ if @first_name.nil?
209
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
210
+ end
211
+
212
+ if @last_name.nil?
213
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
214
+ end
215
+
216
+ if @phone_number.nil?
217
+ invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
218
+ end
219
+
220
+ if @address_line1.nil?
221
+ invalid_properties.push('invalid value for "address_line1", address_line1 cannot be nil.')
222
+ end
223
+
224
+ if @postal_code.nil?
225
+ invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
226
+ end
227
+
228
+ if @city.nil?
229
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
230
+ end
231
+
232
+ if @country.nil?
233
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
234
+ end
235
+
236
+ if @birth_date.nil?
237
+ invalid_properties.push('invalid value for "birth_date", birth_date cannot be nil.')
238
+ end
239
+
240
+ if @license_country.nil?
241
+ invalid_properties.push('invalid value for "license_country", license_country cannot be nil.')
242
+ end
243
+
244
+ if @license_first_issue_date.nil?
245
+ invalid_properties.push('invalid value for "license_first_issue_date", license_first_issue_date cannot be nil.')
246
+ end
247
+
248
+ if @license_number.nil?
249
+ invalid_properties.push('invalid value for "license_number", license_number cannot be nil.')
250
+ end
251
+
252
+ invalid_properties
253
+ end
254
+
255
+ # Check to see if the all the properties in the model are valid
256
+ # @return true if the model is valid
257
+ def valid?
258
+ warn '[DEPRECATED] the `valid?` method is obsolete'
259
+ return false if @id.nil?
260
+ return false if @first_name.nil?
261
+ return false if @last_name.nil?
262
+ return false if @phone_number.nil?
263
+ return false if @address_line1.nil?
264
+ return false if @postal_code.nil?
265
+ return false if @city.nil?
266
+ return false if @country.nil?
267
+ return false if @birth_date.nil?
268
+ return false if @license_country.nil?
269
+ return false if @license_first_issue_date.nil?
270
+ return false if @license_number.nil?
271
+ true
272
+ end
273
+
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] Object to be compared
276
+ def ==(o)
277
+ return true if self.equal?(o)
278
+ self.class == o.class &&
279
+ id == o.id &&
280
+ first_name == o.first_name &&
281
+ last_name == o.last_name &&
282
+ phone_number == o.phone_number &&
283
+ address_line1 == o.address_line1 &&
284
+ address_line2 == o.address_line2 &&
285
+ postal_code == o.postal_code &&
286
+ city == o.city &&
287
+ country == o.country &&
288
+ birth_date == o.birth_date &&
289
+ license_country == o.license_country &&
290
+ license_first_issue_date == o.license_first_issue_date &&
291
+ license_number == o.license_number
292
+ end
293
+
294
+ # @see the `==` method
295
+ # @param [Object] Object to be compared
296
+ def eql?(o)
297
+ self == o
298
+ end
299
+
300
+ # Calculates hash code according to all attributes.
301
+ # @return [Integer] Hash code
302
+ def hash
303
+ [id, first_name, last_name, phone_number, address_line1, address_line2, postal_code, city, country, birth_date, license_country, license_first_issue_date, license_number].hash
304
+ end
305
+
306
+ # Builds the object from hash
307
+ # @param [Hash] attributes Model attributes in the form of hash
308
+ # @return [Object] Returns the model itself
309
+ def self.build_from_hash(attributes)
310
+ return nil unless attributes.is_a?(Hash)
311
+ attributes = attributes.transform_keys(&:to_sym)
312
+ transformed_hash = {}
313
+ openapi_types.each_pair do |key, type|
314
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
315
+ transformed_hash["#{key}"] = nil
316
+ elsif type =~ /\AArray<(.*)>/i
317
+ # check to ensure the input is an array given that the attribute
318
+ # is documented as an array but the input is not
319
+ if attributes[attribute_map[key]].is_a?(Array)
320
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
321
+ end
322
+ elsif !attributes[attribute_map[key]].nil?
323
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
324
+ end
325
+ end
326
+ new(transformed_hash)
327
+ end
328
+
329
+ # Deserializes the data based on type
330
+ # @param string type Data type
331
+ # @param string value Value to be deserialized
332
+ # @return [Object] Deserialized data
333
+ def self._deserialize(type, value)
334
+ case type.to_sym
335
+ when :Time
336
+ Time.parse(value)
337
+ when :Date
338
+ Date.parse(value)
339
+ when :String
340
+ value.to_s
341
+ when :Integer
342
+ value.to_i
343
+ when :Float
344
+ value.to_f
345
+ when :Boolean
346
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
347
+ true
348
+ else
349
+ false
350
+ end
351
+ when :Object
352
+ # generic object (usually a Hash), return directly
353
+ value
354
+ when /\AArray<(?<inner_type>.+)>\z/
355
+ inner_type = Regexp.last_match[:inner_type]
356
+ value.map { |v| _deserialize(inner_type, v) }
357
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
358
+ k_type = Regexp.last_match[:k_type]
359
+ v_type = Regexp.last_match[:v_type]
360
+ {}.tap do |hash|
361
+ value.each do |k, v|
362
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
363
+ end
364
+ end
365
+ else # model
366
+ # models (e.g. Pet) or oneOf
367
+ klass = GetAroundOwner.const_get(type)
368
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
369
+ end
370
+ end
371
+
372
+ # Returns the string representation of the object
373
+ # @return [String] String presentation of the object
374
+ def to_s
375
+ to_hash.to_s
376
+ end
377
+
378
+ # to_body is an alias to to_hash (backward compatibility)
379
+ # @return [Hash] Returns the object in the form of hash
380
+ def to_body
381
+ to_hash
382
+ end
383
+
384
+ # Returns the object in the form of hash
385
+ # @return [Hash] Returns the object in the form of hash
386
+ def to_hash
387
+ hash = {}
388
+ self.class.attribute_map.each_pair do |attr, param|
389
+ value = self.send(attr)
390
+ if value.nil?
391
+ is_nullable = self.class.openapi_nullable.include?(attr)
392
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
393
+ end
394
+
395
+ hash[param] = _to_hash(value)
396
+ end
397
+ hash
398
+ end
399
+
400
+ # Outputs non-array value in the form of hash
401
+ # For object, use to_hash. Otherwise, just return the value
402
+ # @param [Object] value Any valid value
403
+ # @return [Hash] Returns the value in the form of hash
404
+ def _to_hash(value)
405
+ if value.is_a?(Array)
406
+ value.compact.map { |v| _to_hash(v) }
407
+ elsif value.is_a?(Hash)
408
+ {}.tap do |hash|
409
+ value.each { |k, v| hash[k] = _to_hash(v) }
410
+ end
411
+ elsif value.respond_to? :to_hash
412
+ value.to_hash
413
+ else
414
+ value
415
+ end
416
+ end
417
+
418
+ end
419
+
420
+ end
@@ -0,0 +1,257 @@
1
+ =begin
2
+ #Getaround Owner API
3
+
4
+ ## Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Let’s assume that the access token provided by your account manager is “TOKEN”. Here’s how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query=\"end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00\" curl -i \"https://api-eu.getaround.com/owner/v1/invoices?${query}\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept:application/json\" \\ -H \"Content-Type:application/json\" ``` And here’s how to get the invoice with the id 12345: ```bash curl -i \"https://api-eu.getaround.com/owner/v1/invoices/12345\" \\ -H \"Authorization: Bearer TOKEN\" \\ -H \"Accept: application/json\" \\ -H \"Content-Type: application/json\"\" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the “page” and “per_page” params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel=\"next\" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href=\"mailto:owner-api@getaround.com\">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action=\"/docs/api/owner/fire_ping_webhook\" method=\"post\"><input type=\"submit\" value=\"Send Ping Event\"></form> You should receive the following JSON payload: ```json { \"data\": { \"ping\": \"pong\" }, \"type\": \"ping\", \"occurred_at\": \"2019-04-18T08:30:05Z\" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) \"I got some JSON: \#{push.inspect}\" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a \"constant time\" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, it’s possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: owner-api@getaround.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module GetAroundOwner
17
+ class GetaroundUsersUpdated
18
+ attr_accessor :type
19
+
20
+ attr_accessor :data
21
+
22
+ # The webhook event occurred at timestamp
23
+ attr_accessor :occurred_at
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'type' => :'type',
29
+ :'data' => :'data',
30
+ :'occurred_at' => :'occurred_at'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'type' => :'Object',
43
+ :'data' => :'GetaroundUsersUpdatedAllOfData',
44
+ :'occurred_at' => :'Time'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'type',
52
+ ])
53
+ end
54
+
55
+ # List of class defined in allOf (OpenAPI v3)
56
+ def self.openapi_all_of
57
+ [
58
+ :'GetaroundWebhook'
59
+ ]
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `GetAroundOwner::GetaroundUsersUpdated` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `GetAroundOwner::GetaroundUsersUpdated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'type')
78
+ self.type = attributes[:'type']
79
+ else
80
+ self.type = nil
81
+ end
82
+
83
+ if attributes.key?(:'data')
84
+ self.data = attributes[:'data']
85
+ else
86
+ self.data = nil
87
+ end
88
+
89
+ if attributes.key?(:'occurred_at')
90
+ self.occurred_at = attributes[:'occurred_at']
91
+ else
92
+ self.occurred_at = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @data.nil?
102
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
103
+ end
104
+
105
+ if @occurred_at.nil?
106
+ invalid_properties.push('invalid value for "occurred_at", occurred_at cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ warn '[DEPRECATED] the `valid?` method is obsolete'
116
+ return false if @data.nil?
117
+ return false if @occurred_at.nil?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ type == o.type &&
127
+ data == o.data &&
128
+ occurred_at == o.occurred_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [type, data, occurred_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = GetAroundOwner.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end