Last active
February 18, 2021 16:36
-
-
Save stephenrichards/f74880a1f8b7936e6a69e75817537a79 to your computer and use it in GitHub Desktop.
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
# This gist finds the case add request payload, and scans it to pull out the Response value for a | |
# particular attribute (in this case, APPLY_CASE_MEANS_REVIEW, which appears twice in the payload) | |
# | |
laa = LegalAidApplication.find_by(application_ref: 'L-7WE-R99') | |
s = laa.ccms_submission | |
h = s.submission_history.find_by(to_state: 'case_submitted') | |
doc = Nokogiri::XML(h.request).remove_namespaces! | |
case_review_attrs = doc.xpath("//*[text() = 'APPLY_CASE_MEANS_REVIEW']") | |
case_review_attrs.each do |attr| | |
siblings = attr.parent.children | |
response_value = siblings.detect{ |s| s.name == 'ResponseValue'}.text | |
results << "#{laa.application_ref} #{response_value}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment