This is probably really obvious. But I can''t see it. I have ActiveResource enabled client talking to RESTful server. Instead of using link_to from the client to call the resource on the server, I''d like to do this machine-to-machine, ie with no human intervention. What''s the link_to equivalent for the client to call the server without human intervention? As I say, I''m sure this is obvious ... but not to me! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 5/8/07, jason <jason-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote:> > This is probably really obvious. But I can''t see it. > > I have ActiveResource enabled client talking to RESTful server. > Instead of using link_to from the client to call the resource on the > server, I''d like to do this machine-to-machine, ie with no human > intervention. > > What''s the link_to equivalent for the client to call the server > without human intervention? > > As I say, I''m sure this is obvious ... but not to me!a cron job? Some kind of scheduler or work queue? -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi I''m probably not making myself clear. I just want to do this within the code. Or is this not sensible? So far as I understand many of the methods available on the server through Rails (like column statistics sum, average) are not available on the client. Instead the client just has access to xml from calling the REST api. I''d like to get the xml without ''browsing'', i.e. let the code make the call to the url and get the xml response. Or I could be barking up the wrong tree completely. Jason On 8 May, 17:47, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5/8/07, jason <j...-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote: > > > > > This is probably really obvious. But I can''t see it. > > > I have ActiveResource enabled client talking to RESTful server. > > Instead of using link_to from the client to call the resource on the > > server, I''d like to do this machine-to-machine, ie with no human > > intervention. > > > What''s the link_to equivalent for the client to call the server > > without human intervention? > > > As I say, I''m sure this is obvious ... but not to me! > > a cron job? Some kind of scheduler or work queue? > > -- > Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 5/8/07, jason <jason-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote:> > Hi > I''m probably not making myself clear. I just want to do this within > the code. Or is this not sensible? > So far as I understand many of the methods available on the server > through Rails (like column statistics sum, average) are not available > on the client. Instead the client just has access to xml from calling > the REST api. > I''d like to get the xml without ''browsing'', i.e. let the code make the > call to the url and get the xml response. Or I could be barking up > the wrong tree completely. > JasonWell, if a human isn''t browsing to your site, you need an automated script to do it, hence the suggestion to use cron or something similar. Look at script/runner perhaps. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jason wrote:> Hi > I''m probably not making myself clear. I just want to do this within > the code. Or is this not sensible? > So far as I understand many of the methods available on the server > through Rails (like column statistics sum, average) are not available > on the client. Instead the client just has access to xml from calling > the REST api. > I''d like to get the xml without ''browsing'', i.e. let the code make the > call to the url and get the xml response. Or I could be barking up > the wrong tree completely. > Jason > > > On 8 May, 17:47, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On 5/8/07, jason <j...-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote: >> >> >> >> >>> This is probably really obvious. But I can''t see it. >>> >>> I have ActiveResource enabled client talking to RESTful server. >>> Instead of using link_to from the client to call the resource on the >>> server, I''d like to do this machine-to-machine, ie with no human >>> intervention. >>> >>> What''s the link_to equivalent for the client to call the server >>> without human intervention? >>> >>> As I say, I''m sure this is obvious ... but not to me! >>> >> a cron job? Some kind of scheduler or work queue? >> >> -- >> Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.com >> > > > > > >Try net::http or open-uri... irb(main):001:0> require ''open-uri'' => true irb(main):002:0> b = open(''http://google.com'').read => "<html><head>...etc" this is a GET request to the given url and returns the response (in your case the given url will return xml which can then be parsed with REXML, Hash.from_xml(b), etc) Hope this helps, Gustav Paul --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi This has been helpful, since it confirms I''m not missing anything simple. For those interested there is a fuller discussion of open-uri in Ruby Cookbook by Carlson & Richardson, page 500. thx Jason On 8 May, 19:42, Gustav Paul <gus...-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org> wrote:> jason wrote: > > Hi > > I''m probably not making myself clear. I just want to do this within > > the code. Or is this not sensible? > > So far as I understand many of the methods available on the server > > through Rails (like column statistics sum, average) are not available > > on the client. Instead the client just has access to xml from calling > > the REST api. > > I''d like to get the xml without ''browsing'', i.e. let the code make the > > call to the url and get the xml response. Or I could be barking up > > the wrong tree completely. > > Jason > > > On 8 May, 17:47, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> On 5/8/07, jason <j...-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote: > > >>> This is probably really obvious. But I can''t see it. > > >>> I have ActiveResource enabled client talking to RESTful server. > >>> Instead of using link_to from the client to call the resource on the > >>> server, I''d like to do this machine-to-machine, ie with no human > >>> intervention. > > >>> What''s the link_to equivalent for the client to call the server > >>> without human intervention? > > >>> As I say, I''m sure this is obvious ... but not to me! > > >> a cron job? Some kind of scheduler or work queue? > > >> -- > >> Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephist... > > Try net::http or open-uri... > > irb(main):001:0> require ''open-uri'' > => true > irb(main):002:0> b = open(''http://google.com'').read > => "<html><head>...etc" > > this is a GET request to the given url and returns the response (in your > case the given url will return xml which can then be parsed with REXML, > Hash.from_xml(b), etc) > > Hope this helps, > Gustav Paul--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 5/8/07, jason <jason-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote:> > Hi > This has been helpful, since it confirms I''m not missing anything > simple. > For those interested there is a fuller discussion of open-uri in Ruby > Cookbook by Carlson & Richardson, page 500. > thx > JasonWouldn''t you just use activeresource instead of bothering with open-uri or something like curl? That''s what it was written for. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ActiveResource is pretty durn simple. Well, I struggled with it for a bit, but that was because I needed to secure the connection with self-signed certs. Unfortunately, ActiveResource does not expose it''s Net::HTTP object or offer delegate setters for the cert, key, and ca_file properties, so I had to monkey-patch it. But that aside, you can use a one app''s ActiveRecord data in another app simply by declaring a model of the same name which extends ActiveResource::Base and provides the url of the other app. b jason wrote:> Hi > This has been helpful, since it confirms I''m not missing anything > simple. > For those interested there is a fuller discussion of open-uri in Ruby > Cookbook by Carlson & Richardson, page 500. > thx > Jason > > On 8 May, 19:42, Gustav Paul <gus...-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org> wrote: >> jason wrote: >>> Hi >>> I''m probably not making myself clear. I just want to do this within >>> the code. Or is this not sensible? >>> So far as I understand many of the methods available on the server >>> through Rails (like column statistics sum, average) are not available >>> on the client. Instead the client just has access to xml from calling >>> the REST api. >>> I''d like to get the xml without ''browsing'', i.e. let the code make the >>> call to the url and get the xml response. Or I could be barking up >>> the wrong tree completely. >>> Jason >>> On 8 May, 17:47, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> On 5/8/07, jason <j...-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote: >>>>> This is probably really obvious. But I can''t see it. >>>>> I have ActiveResource enabled client talking to RESTful server. >>>>> Instead of using link_to from the client to call the resource on the >>>>> server, I''d like to do this machine-to-machine, ie with no human >>>>> intervention. >>>>> What''s the link_to equivalent for the client to call the server >>>>> without human intervention? >>>>> As I say, I''m sure this is obvious ... but not to me! >>>> a cron job? Some kind of scheduler or work queue? >>>> -- >>>> Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephist... >> Try net::http or open-uri... >> >> irb(main):001:0> require ''open-uri'' >> => true >> irb(main):002:0> b = open(''http://google.com'').read >> => "<html><head>...etc" >> >> this is a GET request to the given url and returns the response (in your >> case the given url will return xml which can then be parsed with REXML, >> Hash.from_xml(b), etc) >> >> Hope this helps, >> Gustav Paul > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Personally, yes, I''m sticking with ActiveResource. This post for me was about understanding where the edges are. I''d become used to writing code in controller and views that accessed the models when I needed them. Now I understand I''ve got to pull the data together more fully on the server and also that this architecture has some limitations in terms of using some of the sweetness of Rails. Actually I like the boundaries, it''s just about understanding what they are. Jason On May 8, 10:56 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5/8/07, jason <j...-DBciWbShXhpAfugRpC6u6w@public.gmane.org> wrote: > > > > > Hi > > This has been helpful, since it confirms I''m not missing anything > > simple. > > For those interested there is a fuller discussion of open-uri in Ruby > > Cookbook by Carlson & Richardson, page 500. > > thx > > Jason > > Wouldn''t you just use activeresource instead of bothering with > open-uri or something like curl? That''s what it was written for. > > -- > Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---