Skip to content

Instantly share code, notes, and snippets.

@stephenrichards
Last active February 18, 2021 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenrichards/f74880a1f8b7936e6a69e75817537a79 to your computer and use it in GitHub Desktop.
Save stephenrichards/f74880a1f8b7936e6a69e75817537a79 to your computer and use it in GitHub Desktop.
# 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