activeresource

What is the best way to upload a file to another Rails application?

I 've researched and noticed that ActiveResource lack this functionality. So, what is the current state of the art when doing a file upload? One problem with Guillermo's approach is that the request has to be nested, like this: body = { :file => {:uploaded_data => File.open("#{RAILS_ROOT}/public/tmp/" + original_filename), :owner_id =>...

Consuming non-REST APIs in Rails with ActiveResource

Hi, I'm writing a client that consumes a non-REST API (i.e. GET site.com/gettreasurehunts), which requires that I specify all parameters (even the resource ID) in the request's HTTP body as a custom XML document. I'd like to use Rails and ActiveResource, but I'd be forced to rewrite almost all of ActiveResource's methods. Is there anot...

Overriding/Modifying Rails Class (ActiveResource)

I've been struggling with an issue with ActiveResource for a bit now: when a hostname resolves for an ActiveResource request, but there's no server on the other end to return information, ActiveResource's timeout value doesn't work. The request just hangs. After reviewing the ActiveResource code, I've realized that this is because the u...

Rails ActiveResource

Hi There, We are in the process of building a REST compliant API. The backend is implemented in PHP and we want the interface to follow the convention over configuration motto. Many of the API consumers will be Rails developers, and following a TDD strategy to building out the API, we've considered using ActiveResource to implement a ...

Why to_xml on ActiveResource does not work well?

I have several ActiveResource model in my project. There was so strange to me when I called to_xml on my ActiveResource. The options that I passed to to_xml like :only and :except doesn't work at all. On ActiveRecord, it works really well. Anyone knows? class Node < ActiveResource::Base self.site = NODE_SERVER end # node has uuid, n...

RESTful Media Sharing API

Does anyone know of any good free media sharing sites like twitpic.com, but not for just twitter? It needs to have a good RESTful API. Preferably hosts video and audio as well as images. Kinda like mobypicture.com, but with a RESTful API. ...

ActiveMessaging, ActiveResources, or Ruby XMLRPC

I have a simple jruby+swt based client that collects data on an occasionally connected PC. Now I need to push those records to the server (Rails 2.3). Should I use ActiveMessaging, ActiveResources or Ruby XMLRPC. This is my current understanding: ActiveMessaging - best if server to client communication is needed ActiveResources - hy...

Rails: Specifing params without value to link_to

Supposing the route map.resources :articles how do you get this /articles?most_popular using link_to method? tried the following: link_to articles_path(:most_popular) # exception link_to articles_path(:most_popular => nil) # /articles link_to articles_path(:most_popular => true) # /articles?most_popular=true note: i'm using inh...

ActiveResource 500 Internal Server Error

I am getting a really strange error from ActiveResource. I have a method that calls another system to get a list of products. The list is quite large and takes about 3 minutes to generate and transfer. Since this is really only a once a day kinda thing I built a rake task to run it. In production whenever I run the rake task it fails ...

ActiveResource client not behaving as expected

I have this code: require 'rubygems' require 'activeresource' ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/exercises.log") class Exercise < ActiveResource::Base self.site = "http://localhost" exercises = Exercise.find(:all) ex = Exercise.find(741) ex.name += "_TEST" ex.save end And the generated url...

Is There an Example of Using ActiveResource and XMLRPC for Rails?

I've seen a ton of examples with ActionWebService and XMLRPC, but they're 3 years old and from what I understand, ActiveResource is supposed to replace ActionWebService. I'm familiar with how ActiveResource can use XML to "talk" to other web sites and consume model information, but XML-RPC is a whole different type of thing, wherein you...

Replication to a redundant server with Rails?

I'm working on a Ruby on Rails/PostgreSQL web app that a mobile device communicates with. The mobile device has the ability to post to a primary server and geographically redundant secondary server at the same time. I would to replicate my user and profile data from the primary server to the secondary server instantaneously. Is ActiveRes...

ActiveResource NameError calling a WCF Service

Lately I've been working on validating an architectural design idea using Rails ActiveResource as a client and a WCF restful service as a server. I have the WCF service running on Windows Vista in a bootcamp partition on a Macintosh hosted in VMWare Fusion (self hosted mode). When I call the service from the Mac in a browser, I do indeed...

Can ActiveResource POST a create instead of PUTTing it when an id is specified?

Hi, I'm calling a rails app from another using ActiveResource. I need to supply the id of the new object to the first app (yes, controller create in this app knows how to handle receiving an id), so I do something like this: a = ActiveResourceModel.new(:id => 1231231, :name => "test") a.save However, instead of doing POST to create a ...

Convert CamelCase xml/json to ruby named attributes with ActiveResource

I'm using ActiveResource to consume a REST service. The xml from the service looks like: <Person> <FirstName>Kevin</FirstName> <LastName>Berridge</LastName> </Person> ActiveResource parses this just fine, but it uses the names verbatim. So the model class will look like: p = Person.find(1) p.FirstName p.LastName I would much ...

XML serializing arrays with type="array" in .NET

I'm attempting to serialize a class to XML, but I have some strict requirements on the output (because I want Rails' ActiveResource to consume it). One of those requirements is specifically for arrays. Here's two examples: class Person { public string FirstName { get; set; } } List<Person> people = new List<Person>(); people.Add( new...

Shared user table with Authlogic

Hi guys, I'm looking for a solution in order to reuse the user table of another web application that use Authlogic. I'm trying with ActiveResource (in the new app), but I'm missing something. This is the not working code: #Existing app class User < ActiveRecord::Base attr_accessible :username, :email, :password acts_as_authentic...

Using activeResource without Rails

Hi i'm developing a rails application that expose some methods via activeResource. I want to access these resources through a simple remote ruby script. I want to know if it's possible use activeResource without Rails ...

Security in rails Active resources

How to use cryptography with XML documents used for rails Active resources? Or, is there any way to garantee security and integrity with comunications through rails Active resources? ...

how execute a Python Script with activeresource?

Hi friends, I need to execute this python script: http://superjared.com/static/code/googleMX.py I installed pyactiveresource, but when I execute: python googleMX.py I have this return. Traceback (most recent call last): File "googleMX.py", line 15, in ? from pyactiveresource import ActiveResource ImportError: cannot import name Active...