In the past I have used Net::HTTP to call trivial remote services. These calls have been low frequency so didn''t bother looking into alternatives. I''m now looking at a design where I will be calling a remote service that returns a simple CSV but it will be called frequently and if that service goes down I need to degrade gracefully. I''d like to punt if the web service fails to respond in 1 second (500 ms may be better). Is there a library that makes this simple. Seems like some hackery is needed to make this happen with Net::HTTP ex: http://groups.google.com/group/chicagoruby/browse_thread/thread/8b8aadc26545e165 It seems like there are 100s of ruby http libraries out there. Tony -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tony Primerano wrote in post #972234:> In the past I have used Net::HTTP to call trivial remote services. > These calls have been low frequency so didn''t bother looking into > alternatives. > > I''m now looking at a design where I will be calling a remote service > that returns a simple CSV but it will be called frequently and if that > service goes down I need to degrade gracefully. I''d like to punt if > the web service fails to respond in 1 second (500 ms may be better). > > > Is there a library that makes this simple. Seems like some hackery is > needed to make this happen with Net::HTTP > ex: > http://groups.google.com/group/chicagoruby/browse_thread/thread/8b8aadc26545e165 > > It seems like there are 100s of ruby http libraries out there.Would HTTParty have what you need?> > TonyBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It looks like HTTParty uses Net::HTTP so I''ll just stick with that. I got burned by so many deprecated gems moving from Rails 2 to Rails 3 that use them sparingly now. :-\ On Jan 4, 10:53 am, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> TonyPrimeranowrote in post #972234: > > > > > In the past I have used Net::HTTPto call trivial remote services. > > These calls have been low frequency so didn''t bother looking into > > alternatives. > > > I''m now looking at a design where I will be calling a remote service > > that returns a simple CSV but it will be called frequently and if that > > service goes down I need to degrade gracefully. I''d like to punt if > > the web service fails to respond in 1 second (500 ms may be better). > > > Is there a library that makes this simple. Seems like some hackery is > > needed to make this happen with Net::HTTP > > ex: > >http://groups.google.com/group/chicagoruby/browse_thread/thread/8b8aa... > > > It seems like there are 100s of rubyhttplibraries out there. > > Would HTTParty have what you need? > > > > > Tony > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please quote when replying. Tony Primerano wrote in post #972913:> It looks like HTTParty uses Net::HTTP so I''ll just stick with that.Stick with *which*?> > I got burned by so many deprecated gems moving from Rails 2 to Rails 3 > that use them sparingly now. :-\I see this attitude a lot, and I believe it is silly. If there''s already a library out there that makes your life easier, don''t reinvent the wheel. Laziness is one of the cardinal virtues for programmers! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 6, 3:04 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Please quote when replying. > > Tony Primerano wrote in post #972913: > > > It looks like HTTParty uses Net::HTTP so I''ll just stick with that. > > Stick with *which*? >I''ll just call Net::HTTP directly. I have a simple GET request that returns some simple CSV data.> > > > I got burned by so many deprecated gems moving from Rails 2 to Rails 3 > > that use them sparingly now. :-\ > > I see this attitude a lot, and I believe it is silly. If there''s > already a library out there that makes your life easier, don''t reinvent > the wheel. Laziness is one of the cardinal virtues for programmers!I''m not really reinventing the wheel here. HTTParty is fine but I just wanted a connection timeout via Net::HTTP, which I learned how to do by looking at HTTParty code. If a 1000 line gem is saving me 10 lines of code I''m better off not using it. Gems like authlogic are essential. If I needed more HTTParty features I would use it but for now the standard library is just fine. :-)> > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tony Primerano wrote in post #972944: [...]> If a 1000 line gem is saving me 10 lines of code I''m better off not > using it.Not necessarily true. *You* didn''t have to write the 1000 lines, and you didn''t have to write the extra 10 lines. Where''s the downside? (I''m not saying you should put random crap into your application, but sometimes a library really is the simplest solution.)> Gems like authlogic are essential. If I needed more HTTParty features > I would use it but for now the standard library is just fine. :-)Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jan 6, 2011 at 3:29 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Not necessarily true. *You* didn''t have to write the 1000 lines, and > you didn''t have to write the extra 10 lines. Where''s the downside?Writing 10 lines of code takes a couple minutes, depending on a gem is forever. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote in post #972952:> On Thu, Jan 6, 2011 at 3:29 PM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Not necessarily true. *You* didn''t have to write the 1000 lines, and >> you didn''t have to write the extra 10 lines. Where''s the downside? > > Writing 10 lines of code takes a couple minutes,And installing a gem takes 30 seconds. (In this case, I''d probably write the 10 lines, but not if the numbers were a little different.)> depending on a gem is > forever.No it''s not, unless your tests are that bad. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jan 6, 2011 at 4:04 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>> depending on a gem is >> forever. > > No it''s not, unless your tests are that bad.Depending on a gem or not has not a fucking thing to do with tests. I''m adding you to my kill file, you have proven time and again you are an utter moron. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote in post #972968:> On Thu, Jan 6, 2011 at 4:04 PM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> depending on a gem is >>> forever. >> >> No it''s not, unless your tests are that bad. > > Depending on a gem or not has not a f*cking thing to do with tests. > > I''m adding you to my kill file, you have proven time and again you are > an utter moron.If that means I no longer have to put up with your misinformed sniping, then good riddance. The list will be a happier place.> > > -- > Greg Donald > destiney.com | gregdonald.comBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.