Skip to content

Instantly share code, notes, and snippets.

@JosiahSiegel
Last active June 2, 2017 17:17
Show Gist options
  • Save JosiahSiegel/83b5e9bcd6a695435638 to your computer and use it in GitHub Desktop.
Save JosiahSiegel/83b5e9bcd6a695435638 to your computer and use it in GitHub Desktop.
#Rails Call a REST API
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