Created
December 20, 2012 20:15
-
-
Save anonymous/4348184 to your computer and use it in GitHub Desktop.
Here, I want to get a PR via API and then get the issue contents
This file contains hidden or 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
pull_response = RestCall.get("/repos/bob/rails8/pulls") | |
issue_response = RestCall.get("/repos/bob/rails8/issues/#{response.first['issue']}") | |
# either of these might 404 |
This file contains hidden or 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
pull_response = RestCall.get("/repos/bob/rails8/pulls") | |
issue_response = RestCall.get(pull_response.first["issue_url"]) # => oops, what if response is empty? | |
if pull_response.present? | |
issue_response = RestCall.get(pull_response.first["issue_url"]) # => oops, what if response issue_url isn't there? | |
end | |
if pull_response.present? && pull_response.first["issue_url"].present? | |
issue_response = RestCall.get(pull_response.first["issue_url"]) # OK! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment