Last active
June 2, 2017 17:17
-
-
Save JosiahSiegel/83b5e9bcd6a695435638 to your computer and use it in GitHub Desktop.
#Rails Call a REST API
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
class RestApi | |
include HTTParty | |
base_uri 'http://url/api/v1' | |
def self.get_info(id) | |
response = get("/info/#{id}") | |
response["count"] > 0 ? response["results"]["info"] : "Not Found" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment