Models for external REST services

Hello, I’m new to rails so as an exercise I’m porting (php to rails)
a very simple landing page that talks with a third party REST service
where I just need to do a couple of calls to register a user and show
the status of the whole process. I felt this would be dead simple to
do in Rails (I’m still learning) but I’m having a hard time getting it
working.

My idea was just to have one controller with a couple of actions one
for each REST call an update my view with RJS. It has been kind of
frustating since this was so simple to do in php and I honestly
expected the port to rails to be much simpler, even for someone
learning the framework.

Thanks for your time, I inlcude the code of what I have so far, any
help/links are appreciated

This is what my sign_in partial looks like:

#- view/home/_sign_in.rhtml
<% remote_form_for :sign_in_form, :url => “home/do_sign_in”, :html
=> { :id => ‘sign_in_form’ } do |f| %>




<%= f.text_field :mobile_field1%> # by the way, I get an error if
I try to pass options to the textfield
<%= f.text_field :mobile_field2%> # error says the method just
recieves 2 arguments
<%= f.text_field :mobile_field3%>

<%= select_tag("sign_selection",options_for_select(@signs) )

%>
<%= image_submit_tag(“/images/
subscribe_now_btn.gif”, :border=>0)%>
<%end%>

end snippet

#============================

And this is what the model looks like (I assume I need a model for the
remote_form_for) and I’m pretty sure this is far from what I need

model/sign_in_form.rb

class SignInForm < ActiveRecord::Base

attr_accessor :mobile_field1, :mobile_field2, :mobile_field3,
:mobile_number, :sign

def mobile_number=(val)
@mobile_number = val
end

mobile_number is supposed to be some sort of virtual attribute

def mobile_number
@mobile_field1+@mobile_field2+@mobile_field3
end

def sign=(val)
@sign = val.capitalize
end

def sign
@sign
end

def mobile_field1=(val)
@mobile_field1 = val
end

def mobile_field1
@mobile_field1
end

#getters and setters for the other mobile_field

end snippet

#============================
On the side of the controlloer I have no idea how to start, this is
what I think it should look like,

def do_sign_in

@sign_in_form #this should come from the form in the view, I have no
idea how to get this object

api_url = “www.example.com/some_api.php

response = some_object.do_post (api_url, :params =>{ “api_key” =>
@key, “param1” => @sign_in_form.field1, “param2” =>
@sign_in_form.field2, } )

after this we should go to a do_sign_in.rjs and do all the ajax

updates

end

#============================