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: e388fb41a5ca5358a1a1679f99173af8675b4ae55a092f7ba9dcd1f20f037bfc
4
- data.tar.gz: e0e8776b945da6b4ad1b0ec0c7631c9ce9368f695b1b3275d9d5a11b7465cdd4
3
+ metadata.gz: feb77d4b04a77b7578914a3b471b0f1ccc7844447c4eba51924a01e4a11d8ad6
4
+ data.tar.gz: e37040bd3b5fd69fed99accaaac378bfd8a8cec21622e27ba2ca7af20580a20b
5
5
  SHA512:
6
- metadata.gz: b8720e5d0de2c966dd0c22ae699ae3bd23036af4e7aa91d67c8dcdee24e8c09b1d440f972da0b1676925e3e4c87e63095e7082c61808672cc131a6a53bde32ca
7
- data.tar.gz: 803e39028a73b7b68e74eeb4ee1708d65623528b8021b7afe4670030f57fe4f1c3b0c3a8a057c1d4adb940f9de06dee3e1e0daaacaab33d12a3c80bab9100a78
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
- api_base = graphql_api_origin
223
- url = "#{api_base}/v2/exterior_assessment_slots"
224
- log("REST POST -> #{url}")
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: raw["currentInspectionTime"],
250
- availableSlots: raw["availableSlots"] || [],
251
- isSlotBased: raw["isSlotBased"] || false,
252
- visitId: raw["visitId"] || "",
253
- timezone: raw["timezone"] || "UTC"
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
@@ -1,5 +1,5 @@
1
1
  module Opendoor
2
2
  module PartnerSdk
3
- VERSION = "1.2.1.beta.99.1"
3
+ VERSION = "1.2.1.beta.101.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendoor-partner-sdk-server-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1.beta.99.1
4
+ version: 1.2.1.beta.101.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Opendoor