module UrlHandler
Public Instance Methods
build_url(host, port, path, query)
click to toggle source
# File lib/nlp_toolz/helpers/url_handler.rb, line 8 def build_url(host, port, path, query) return URI::HTTP.build({:host => host, :path => path, :query => query}) if port.nil? return URI::HTTP.build({:host => host, :port => port, :path => path, :query => query}) unless port.nil? end
post_data(content,uri,content_type)
click to toggle source
# File lib/nlp_toolz/helpers/url_handler.rb, line 14 def post_data(content,uri,content_type) post = Net::HTTP::Post.new(uri.request_uri,content_type) post.body = content.force_encoding("utf-8") uri_response = Net::HTTP.start(uri.host,uri.port) {|http| http.request(post)} uri_response end