Skip to content

Instantly share code, notes, and snippets.

@jspillers
Created January 30, 2012 20:45
Show Gist options
  • Save jspillers/1706581 to your computer and use it in GitHub Desktop.
Save jspillers/1706581 to your computer and use it in GitHub Desktop.
require 'rest_client'
def import(service_url, uri, data)
JSON.parse(
RestClient.post(
"#{service_url}#{uri}",
data.to_json,
content_type: :json,
accept: :json
)
)
end
# example:
# response = import('http://www.example.com', '/some/resource', { somehash: 'with stuff' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment