opendoor-partner-sdk-server-ruby 1.2.1.beta.100.1 → 1.2.1.beta.102.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c0c334f99420dca8428f6901f85587f0e0d14cc62b793fb63b414c1b09edad1
|
|
4
|
+
data.tar.gz: dd7046ba3b574eb987458e760158e4d4b7c2842d294a8bb1637b0c2c1b655e30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91a40b1b674d5c25786eb7fada952e6dd69932d2f1b659f9faa9d9f31f545e797e615575c478cb37f64a2a20f1ae16c5713aff169a7d8233b847c091a2acbe09
|
|
7
|
+
data.tar.gz: 6fa5d701c8a8c46344aabd7fc554de5606844bae099d5321f4a2a0bf00b6869f7474391c44c0457bba663ee16afacd6865659adcaadb8288fd20311ebc5002cb
|
|
@@ -219,41 +219,23 @@ module Opendoor
|
|
|
219
219
|
def get_assessment_slots(offer_id:, calendar_type: "ASSESSMENT_VISIT")
|
|
220
220
|
raise ValidationError.new("offerId is required", "offerId") if blank?(offer_id)
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
api_base = address_endpoint_origin
|
|
226
|
-
url = "#{api_base}/partner-api-proxy/v2/exterior_assessment_slots"
|
|
227
|
-
log("REST POST -> #{url}")
|
|
228
|
-
|
|
229
|
-
response = fetch_with_timeout(
|
|
230
|
-
url,
|
|
231
|
-
method: :post,
|
|
232
|
-
headers: {
|
|
233
|
-
"Content-Type" => "application/json",
|
|
234
|
-
"Authorization" => "Basic #{@api_key}"
|
|
235
|
-
},
|
|
236
|
-
body: JSON.generate(
|
|
237
|
-
partnerId: @api_key,
|
|
222
|
+
data = graphql(
|
|
223
|
+
query: Graphql::EXTERIOR_ASSESSMENT_SLOTS_QUERY,
|
|
224
|
+
variables: {
|
|
238
225
|
sellerInputUuid: offer_id,
|
|
239
226
|
# Default: pre-UW assessment (the post-IFO Lennar Trade-In path).
|
|
240
227
|
# "DILIGENCE_VISIT" is the post-contract Inspectify visit.
|
|
241
228
|
calendarType: calendar_type
|
|
242
|
-
|
|
229
|
+
}
|
|
243
230
|
)
|
|
244
|
-
ensure_ok!(response, "Assessment slots request failed", "NETWORK_ERROR")
|
|
245
|
-
raw = parse_json_response(response.body, http_status: response.code.to_i)
|
|
246
|
-
|
|
247
|
-
unless raw["success"]
|
|
248
|
-
raise ApiError.new(raw["error"] || "Assessment slots request failed", "API_ERROR", 200)
|
|
249
|
-
end
|
|
250
231
|
|
|
232
|
+
slots = data["exteriorAssessmentSlots"] || {}
|
|
251
233
|
{
|
|
252
|
-
currentInspectionTime:
|
|
253
|
-
availableSlots:
|
|
254
|
-
isSlotBased:
|
|
255
|
-
visitId:
|
|
256
|
-
timezone:
|
|
234
|
+
currentInspectionTime: slots["currentInspectionTime"],
|
|
235
|
+
availableSlots: slots["availableSlots"] || [],
|
|
236
|
+
isSlotBased: slots["isSlotBased"] || false,
|
|
237
|
+
visitId: slots["visitId"] || "",
|
|
238
|
+
timezone: slots["timezone"] || "UTC"
|
|
257
239
|
}
|
|
258
240
|
end
|
|
259
241
|
|
|
@@ -435,25 +417,6 @@ module Opendoor
|
|
|
435
417
|
value.nil? || value.to_s.strip.empty?
|
|
436
418
|
end
|
|
437
419
|
|
|
438
|
-
# Same-origin base as JS `new URL(apiEndpoint).origin` (includes non-default port).
|
|
439
|
-
def graphql_api_origin
|
|
440
|
-
uri_origin(@api_endpoint)
|
|
441
|
-
end
|
|
442
|
-
|
|
443
|
-
# Cloudflare-worker origin (where /partner-api-proxy/v2/* routes live).
|
|
444
|
-
def address_endpoint_origin
|
|
445
|
-
uri_origin(@address_endpoint)
|
|
446
|
-
end
|
|
447
|
-
|
|
448
|
-
def uri_origin(endpoint)
|
|
449
|
-
uri = URI.parse(endpoint)
|
|
450
|
-
if uri.respond_to?(:origin) && !uri.origin.nil?
|
|
451
|
-
uri.origin
|
|
452
|
-
else
|
|
453
|
-
"#{uri.scheme}://#{uri.host}#{uri.port && ![80, 443].include?(uri.port) ? ":#{uri.port}" : ""}"
|
|
454
|
-
end
|
|
455
|
-
end
|
|
456
|
-
|
|
457
420
|
def parse_json_response(body, http_status:)
|
|
458
421
|
JSON.parse(body.to_s)
|
|
459
422
|
rescue JSON::ParserError => e
|
|
@@ -169,6 +169,21 @@ module Opendoor
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
GRAPHQL
|
|
172
|
+
|
|
173
|
+
# `calendarType` is "ASSESSMENT_VISIT" for the pre-underwriting home
|
|
174
|
+
# assessment (post-IFO Lennar Trade-In path) or "DILIGENCE_VISIT" for
|
|
175
|
+
# the post-contract Inspectify visit.
|
|
176
|
+
EXTERIOR_ASSESSMENT_SLOTS_QUERY = <<~GRAPHQL.freeze
|
|
177
|
+
query ExteriorAssessmentSlots($sellerInputUuid: String!, $calendarType: CalendarType!) {
|
|
178
|
+
exteriorAssessmentSlots(sellerInputUuid: $sellerInputUuid, calendarType: $calendarType) {
|
|
179
|
+
timezone
|
|
180
|
+
availableSlots
|
|
181
|
+
currentInspectionTime
|
|
182
|
+
isSlotBased
|
|
183
|
+
visitId
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
GRAPHQL
|
|
172
187
|
end
|
|
173
188
|
end
|
|
174
189
|
end
|