opendoor-partner-sdk-server-ruby 1.2.1.beta.99.1 → 1.2.1.beta.101.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: feb77d4b04a77b7578914a3b471b0f1ccc7844447c4eba51924a01e4a11d8ad6
|
|
4
|
+
data.tar.gz: e37040bd3b5fd69fed99accaaac378bfd8a8cec21622e27ba2ca7af20580a20b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 670480628011e6d732825d0d8527bab7be967319b122116c5f42a55db6ddc49e16fa7b60035d7e3d813baab130a2a8c768e4cfdc2c46ee3eb1e76da97f9f6c49
|
|
7
|
+
data.tar.gz: a08d3c269c2f0deb2011d3580a57c03d2038acac329260494ca5d2e6cb6963c21c871589a01c489539a6ffb86d9b324fbd984f68a75c3744418a96be5611d1cd
|
|
@@ -219,38 +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
|
-
|
|
226
|
-
response = fetch_with_timeout(
|
|
227
|
-
url,
|
|
228
|
-
method: :post,
|
|
229
|
-
headers: {
|
|
230
|
-
"Content-Type" => "application/json",
|
|
231
|
-
"Authorization" => "Basic #{@api_key}"
|
|
232
|
-
},
|
|
233
|
-
body: JSON.generate(
|
|
234
|
-
partnerId: @api_key,
|
|
222
|
+
data = graphql(
|
|
223
|
+
query: Graphql::EXTERIOR_ASSESSMENT_SLOTS_QUERY,
|
|
224
|
+
variables: {
|
|
235
225
|
sellerInputUuid: offer_id,
|
|
236
226
|
# Default: pre-UW assessment (the post-IFO Lennar Trade-In path).
|
|
237
227
|
# "DILIGENCE_VISIT" is the post-contract Inspectify visit.
|
|
238
228
|
calendarType: calendar_type
|
|
239
|
-
|
|
229
|
+
}
|
|
240
230
|
)
|
|
241
|
-
ensure_ok!(response, "Assessment slots request failed", "NETWORK_ERROR")
|
|
242
|
-
raw = parse_json_response(response.body, http_status: response.code.to_i)
|
|
243
|
-
|
|
244
|
-
unless raw["success"]
|
|
245
|
-
raise ApiError.new(raw["error"] || "Assessment slots request failed", "API_ERROR", 200)
|
|
246
|
-
end
|
|
247
231
|
|
|
232
|
+
slots = data["exteriorAssessmentSlots"] || {}
|
|
248
233
|
{
|
|
249
|
-
currentInspectionTime:
|
|
250
|
-
availableSlots:
|
|
251
|
-
isSlotBased:
|
|
252
|
-
visitId:
|
|
253
|
-
timezone:
|
|
234
|
+
currentInspectionTime: slots["currentInspectionTime"],
|
|
235
|
+
availableSlots: slots["availableSlots"] || [],
|
|
236
|
+
isSlotBased: slots["isSlotBased"] || false,
|
|
237
|
+
visitId: slots["visitId"] || "",
|
|
238
|
+
timezone: slots["timezone"] || "UTC"
|
|
254
239
|
}
|
|
255
240
|
end
|
|
256
241
|
|
|
@@ -432,16 +417,6 @@ module Opendoor
|
|
|
432
417
|
value.nil? || value.to_s.strip.empty?
|
|
433
418
|
end
|
|
434
419
|
|
|
435
|
-
# Same-origin base as JS `new URL(apiEndpoint).origin` (includes non-default port).
|
|
436
|
-
def graphql_api_origin
|
|
437
|
-
uri = URI.parse(@api_endpoint)
|
|
438
|
-
if uri.respond_to?(:origin) && !uri.origin.nil?
|
|
439
|
-
uri.origin
|
|
440
|
-
else
|
|
441
|
-
"#{uri.scheme}://#{uri.host}#{uri.port && ![80, 443].include?(uri.port) ? ":#{uri.port}" : ""}"
|
|
442
|
-
end
|
|
443
|
-
end
|
|
444
|
-
|
|
445
420
|
def parse_json_response(body, http_status:)
|
|
446
421
|
JSON.parse(body.to_s)
|
|
447
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
|