[Rails] NET/HTTP GET VALUE

2015-03-07 Thread Simon Eric
I have two app in rails that communicate between net/http: In the first app controller is something like so: class WebservicesController ApplicationController require 'net/http' require uri layout 'admin' def ws uri = URI(http://localhost:3001/api/ws;)

[Rails] Net::HTTP

2013-05-07 Thread John Merlino
I'm looking at the documentation: http://ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html And I notice two uses of Net::HTTP. Both are using GET requests. But what's the difference? When to use which? Net::HTTP.start(uri.host, uri.port) do |http| request = Net::HTTP::Get.new uri

Re: [Rails] Net::HTTP

2013-05-07 Thread tamouse mailing lists
On Tue, May 7, 2013 at 12:43 PM, John Merlino stoici...@aol.com wrote: I'm looking at the documentation: http://ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html And I notice two uses of Net::HTTP. Both are using GET requests. But what's the difference? When to use which?

[Rails] Net::HTTP end of file reached

2011-04-27 Thread Erwin
Doing a check on a remote file url, using Net::HTTP, I get an 'end of file reached' here is the Ruby code (1.9.2) [env ; Rails3 , webrick ] url = URI.parse(URI.escape(test_upload.videoUrl)) req = Net::HTTP::Head.new(url.path) res = Net::HTTP.start(url.host, url.port) {|http|

Re: [Rails] Net::HTTP end of file reached

2011-04-27 Thread Bryan Crossland
On Wed, Apr 27, 2011 at 6:11 PM, Erwin yves_duf...@mac.com wrote: Doing a check on a remote file url, using Net::HTTP, I get an 'end of file reached' here is the Ruby code (1.9.2) [env ; Rails3 , webrick ] url = URI.parse(URI.escape(test_upload.videoUrl)) req =

[Rails] Net::HTTP URI.parse

2011-01-07 Thread Sasi
HI All, i am new to ROR i am writing Ruby code for calling API blogs i have written ruby code for creating a attachment xml by require 'net/http' require 'uri' url = URI.parse('https://localhost:3000/api/attachment/create.xml') req = Net::HTTP::Post.new(url.path) req.basic_auth 'a', 'a'

[Rails] net/http set content-type for images

2010-06-06 Thread Kim
I need to pull an image from a URL (I have permission) that is a .jpg. I know I need to set the content-type to 'image/jpeg', but not sure where to do that at. result = Net::HTTP.get_response(URI.parse('http:// link_to_image.jpg') ) result.body = gives me encoded junk. Looking for help on how

Re: [Rails] net/http set content-type for images

2010-06-06 Thread Hassan Schroeder
On Sun, Jun 6, 2010 at 5:40 PM, Kim kim.gri...@gmail.com wrote: I need to pull an image from a URL (I have permission) that is a .jpg.  result = Net::HTTP.get_response(URI.parse('http:// link_to_image.jpg') ) result.body = gives me encoded junk. No, it gives you what you asked for: a

[Rails] Net::http breaks post request, Curb (curl) does not

2010-01-20 Thread comopasta Gr
Hi, I'm having a problem with a simple post request. The issue is that the receiving side fails to process the message because apparently the body of the post message is not sent in a single packet together with the headers. The body contains only xml. I'm running webrick. The thing is that if I

[Rails] Net::HTTP question

2009-11-13 Thread jhaagmans
Hi, I'm doing this: response = Net::HTTP.start(host).request_head('/') To check a domain for its response. Now some of the domains checked will not exist and thus produce the following error: SocketError: getaddrinfo: Name or service not known But I don't want my application to fail when