activeresource

How to submit multipart messages using ActiveResource?

I am trying send user profile images from a client to the server using ActiveResource. It looks like ActiveResource doesn't support multi-part. Is there a gem/plugin that adds Multipart support to ActiveResource? Or any other alternative approach to addressing this issue. ...

Problem Unit Testing ActiveResource Model with HttpMock

I'm working on unit testing an ActiveResource model in my Rails application. I have my ActiveResource::HttpMock code in my test file as follows: ActiveResource::HttpMock.respond_to do |mock| mock.get "/audience/42/people/1.xml", {"Authorization" => "Basic VTExbTJCTzhkZzNMOmFpdU1nbHZJT2taakdPV3A=", "Accept" => "application/xml"}, @some...

Multiple key/value pairs in HTTP POST where key is the same name

I'm working on an API that accepts data from remote clients, some of which where the key in an HTTP POST almost functions as an array. In english what this means is say I have a resource on my server called "class". A class in this sense, is the type a student sits in and a teacher educates in. When the user submits an HTTP POST to creat...

Self documenting REST interface

I have a Rails based server running several REST services and a Rails based web UI that interacts with the server using ActiveResource. Same server is being used by other clients( e.g: mobile). I have to generate documentation for the REST interface. I need to provide service URL, input/output and error document structure for each servic...

Active record model with remote data storage

I want to implement a model "Contact", whose data is not stored in database, but remotely. The operations on data are done via web service. The model Contact is related to other models, whose data is stored locally. Is there any plugin/gem which can take care of this? Regards, Pankaj ...

Local data about an ActiveResource

Using Ruby on Rails, is there any clean way to store data locally about a remote ActiveResource? For example, I'd like to add a local field like requested_at to store the last time the resource was requested from the remote API. ...

Rails ActiveResource Associations

I have some ARes models (see below) that I'm trying to use associations with (which seems to be wholly undocumented and maybe not possible but I thought I'd give it a try) So on my service side, my ActiveRecord object will render something like render :xml => @group.to_xml(:include => :customers) (see generated xml below) The models...

How to properly use ActiveResource::CustomMethods when constructing URL?

Currently I am using Active Resource to consume a REST API. It works fine for simple things but for some reason will not respect custom methods. E.G. API::Model.find(m.id) #This works as expected API::Model.find(m.id).put(:foo) #This is equivalent to doing the above The Rails API http://api.rubyonrails.org/classes/ActiveResource/Cu...

How do I verify the URL that ActiveResource intends to use on a call?

Hi there, I'm trying to request data from another Rails app, but I keep getting a "URL not found" error. Is it possible to use the debugger to figure out the intended URL and parameters for an intended ActiveResource call? For example, I'd like to make a GET request with the following parameters: https://some_server.com/employees/searc...

Designing Web Service Using Ruby on Rails - Mapping ActiveRecord Models

I've put together a RoR application and would now like to publish a RESTful web service for interacting with my application. I'm not sure where to go exactly, I don't want to simply expose my ActiveRecord models since there is some data on each model that isn't needed or shouldn't be exposed via an API like this. I also don't want to c...

Add api key to every request in ActiveResource

I have 2 RESTful Rails apps I'm trying to make talk to each other. Both are written in Rails 3 (beta3 at the moment). The requests to the service will require the use an api key which is just a param that needs to be on every request. I can't seem to find any information on how to do this. You define the url the resource connects to via...

running "complex" queries with amazon SDB (simpledb) - aws-sdb + ActiveResource

I am considering the following a "complex" query, given the fact that simpledb is a really simple data storage: I am trying to query a aws-sdb domain with an OR query. using ruby, rails (2) and ActiveResource. I am using the code examples from http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1242 (which don't show Or ...

amazon simpledb with aws-sdb-proxy suitable for high traffic production app?

i am using amazon simpledb with the aws_sdb gem and aws-sdb proxy as outlined in a documentation from amazon with ruby on rails and a local aws proxy that runs on webrick (providing a bridge with ActiveResource). see http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1242 i am wondering if the aws-sdb-proxy (webrick!)...

log analysis for rails

i have a rails app which makes heavy use of activeresource and httparty to make api calls. Is there any library/extension to log the requests and parse them, so that log analysis becomes easier and automated. RailsLogAnalyser is good but what about extra calls, what are the conventions? Something like a opensource/self-hosted alte...

Handling Active Resource Error

Hi. I have a simple question, and I am sure there is a standard answer to it; just can't find it. I have an ActiveResource user model in my rails app. It points to another rails app where my actual user entity lives. Everything in my app works fine while both apps are up. But when my back-end rails app is down; and I try to access activ...

Using ActiveResource POST to create an entry in another Rails application

Hi There are 2 apps App1 and App2 and I am trying to create an entry into the items table of App2 from App1 using ActiveResource I want this to work: new_item = App2::Item.create(:property1 => "foo", :property2 => "bar") This is what I am doing: In App1: module App2 class Item < ActiveResource::Base self.site = "http:/...

ActiveResource error handling

Hi. I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and I need to handle those BackApp validations in FrontApp. I have following active-res...

ActiveResource maximum length ??

I've been getting some exceptions on my production machine (terrible i know!) and they are always XML parsing exceptions from ActiveResource. They always throw an error about invalid xml saying Couldn't find end of Start Tag c line 1337 When I look at line 1337 of the xml request (if I make that service request in my browser) the...

Customize the URL hit from ActiveResource

I have an application App2 to which I am sending a POST request from App1 using ActiveResource. On the App1, I have module App2 class Iteeem # Purposely misspelled here def self.edit_item self.prefix "/api/editing_item/" post :item, {:property => {:value => 5665}} end end end It hits h...

accepts_nested_attributes_for and Active Resource

I'd like to use accepts_nested_attributes_for with Active Resource. Is this possible? I have been experimenting in console and passing in nested attributes works, however the nested models fail to create because the foreign_key is never set. For example, I have a user class that accepts_nested_attributes_for :credentials. The JSON c...