Storing contacts or leads in fatfreecrm with activeresource

Apr 2011

I was suprised how easy it was using ActiveResource in Rails to store information in FatFreeCRM. I wanted users who register to my new site to appear as Leads. I ran the script/console session below. Note the username:password combination this is how you get past Restful Authentication.

Loading development environment (Rails 2.3.8) 
>> class Lead < ActiveResource::Base                                                                  
>> self.site = 'http://username:[email protected]/'                                                                  
>> end
=> "http://username:[email protected]"
>>
>> l = Lead.new({ :first_name => 'Des', :last_name => 'Oconner', :email => [email protected]', :user_id => 1 })
=> #<Lead:0xb6996068 @attributes={"user_id"=>1, "last_name"=>"Oconner", "first_name"=>"Des", "email"=>"[email protected]"}, @pref
ix_options={}>
>> l.save
=> true
>>