Class: Earl::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/earl_post.rb

Class Method Summary collapse

Class Method Details

.to_url(url, data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/earl_post.rb', line 8

def self.to_url(url,data)
  # submit lead to url via xml format. 
  # will return the response, use response.body to analyze
  ssl = url.include? "https"
  url = URI.parse(url)
  http = Net::HTTP.new(url.host, url.port) 
  http.use_ssl = ssl
  request = Net::HTTP::Post.new(url.path)
  request.body = data
  http.request(request).body
end