Skip to content

Instantly share code, notes, and snippets.

@henryhamon
Created July 31, 2010 17:29
Show Gist options
  • Save henryhamon/502403 to your computer and use it in GitHub Desktop.
Save henryhamon/502403 to your computer and use it in GitHub Desktop.
# Realiza um PUT no servidor
def self.put(uri, content = {})
url = URI.parse(uri)
req = Net::HTTP::Put.new(uri)
req.basic_auth APP_CONFIG['email'], APP_CONFIG['password']
Net::HTTP.start(url.host, url.port) do |http|
req['Content-Type'] = 'text/plain; charset=utf-8'
req.set_form_data(content) unless content == {}
http.request(req)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment