Class: SecurePost

Inherits:
Object
  • Object
show all
Defined in:
lib/domain-finder/secure_post.rb

Overview

Simple class for helping to easily make a secure POST without messing with Net::HTTP

Class Method Summary collapse

Class Method Details

.post(url, data = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/domain-finder/secure_post.rb', line 4

def self.post url, data = {}
  uri = URI.parse url
  http = Net::HTTP.new uri.host, 443
  http.use_ssl = true
  resp, data   = http.post(uri.path, data.map{ |k,v| "#{k}=#{v}" }.join('&'), {})
  data
end