Last active
October 10, 2019 18:18
-
-
Save epaulet/ef15fa77195b6fc8aadd4dd1d2481870 to your computer and use it in GitHub Desktop.
Find nearby EScreen location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request_id = 36630 # replace this with the real response ID | |
payload = Request.find(request_id).payload | |
appointment = Appointment.find_by(external_donor_id: payload[:external_donor_id]) | |
location_query = OpenStruct.new( | |
account_id: appointment.account_id, | |
exam_slugs: appointment.exam_slugs, | |
zipcode: payload[:collection_site_zipcode], | |
) | |
location_hashes = LocationsService.get_locations_as_hashes(location_query) | |
## Browse through location_hashes and select a replacement location. Using the first location as an example. | |
location_hash = location_hashes.first | |
duped_payload = payload.dup | |
duped_payload[:collection_site_id] = location_hash[:site_id] | |
duped_payload[:collection_site_zipcode] = location_hash[:zipcode] | |
response.payload = duped_payload | |
response.save # probably not necessary, but doesn't hurt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment