Guest User

Untitled

a guest
May 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. # f is a field name/value hash that I will use to populate the CSV record
  2. # d is the top level object returned by the SOAP call
  3.  
  4. # Apparently, if a value is optional, and does not exist in the response,
  5. # a function will not be created for it. That's why I need the respond_to's.
  6.  
  7. ok = (d.respond_to?('relevantContractDates') and d.relevantContractDates != nil)
  8. e = ok ? d.relevantContractDates : nil
  9.  
  10. f[:signedDate] = (ok and e.respond_to?('signedDate')) ? e.signedDate : nil
  11. f[:effectiveDate] = (ok and e.respond_to?('effectiveDate')) ? e.effectiveDate : nil
  12. f[:currentCompletionDate] = (ok and e.respond_to?('currentCompletionDate')) ? e.currentCompletionDate : nil
  13. f[:ultimateCompletionDate] = (ok and e.respond_to?('ultimateCompletionDate')) ? e.ultimateCompletionDate : nil
Add Comment
Please, Sign In to add comment