Rails how to push data from one rails application to other - ruby-on-rails

I am creating a job website where candidate fill his information and admin/team member can modify these detail and after modification i want to send this data to some other application where it get saves .notice that i want to push each single record like in every candidate information page there will be a button for "push to other application"
I am thinking to do this by creating soap services and sending data through soap api,so please help me by assisting how can i create soap api in rails and send data tho other application.
And please assist me the other ways how can i do this.
Thanks!

You can connect to other application database and insert the records. The other application can read the records from its database. It is easier to use database communication than soap.

You should not even think about creating a SOAP service, there are no any good implementations of it in Ruby.
Consider using REST API and ActiveResource instead.
ActiveResource GitHub page
ActiveResource 3.2.17 Docs
There are RailsCasts about ActiveResource, though they are a bit outdated you'll get the idea.
#94 ActiveResource Basics
#95 More on ActiveResource
However if for some reason you decide to create a SOAP service take a look at WashOut and Savon gems.

Related

How to use the Appery.io REST API with Ruby on Rails to retrieve information from the Appery.io database?

How can I access the Appery.io (or any future db) that is exposed to the REST API using RoR?
So I have an app i built using Appery.io and I also created a test app using RoR that I would like to use to pull information from the Appery.io db and display it on my RoR app.
I am somewhat familiar with REST and get the idea of what it is doing but I am not to certain on how to connect or make a connection from my RoR app to my Appery.io app. Appery.io has the following documentation for their db api, Appery.io DB API .
I have been looking around and also have seen people mention the following gems for HTTP request:
Weary
HTTParty
RestClient
Would I use one of those? I also read about using Active Resource as a possible solution?
Any help with getting started or a tutorial or article to point me in the right direction would be very helpful.
Thanks!
You won't be establishing an ongoing connection, each request/response will be a single query to your Appery DB. You authenticate those calls using a custom header with API key as defined in the documentation. There's an example using cURL that might be a good place to start playing with the API before you pull it into your RoR app. That example shows you how to get your key, too.
It looks like you can use the predefined APIs, or you can define a custom REST API associated with your Appery app? Instructions for building an API appear to be here.
Once you get the calls working from cURL (or other web request client of your choice), adding the calls to the RoR app should be more straightforward. Any of those gems could probably ease that process: I've only used RestClient personally, but found it very straightforward.
Any of those call methods (cURL, other clients, the gems, etc) will allow you specify your URI, method (e.g. GET or POST), headers, request body (where appropriate), and will allow you to examine your response. Take a look at the gem documentation to see how those map exactly - it will vary slightly from tool to tool.
If you don't have prior experience with calling external APIs, and would like a conceptual explanation, I like this article as a (very short!) beginner's guide.

How to use Rails as DDP server with Meteor.js client

We have a Rails app that acts HTTP API only. On the client side, Ember.js is currently used. We are not overly impressed by Ember and really like the approach Meteor.js takes. So we'd like to exchange the client side with Meteor.js and communicate with the Rails server via websockets that speak the Data Distribution Protocol (DDP), so we can keep using the models, mailers and controllers in Rails. Implementing server side of DDP should be easy.
However, we're unsure how to make Rails talk websockets. We found Reel, which seems to make it easy to accept websocket requests in a standalone environment. Reel seems great as we'd like to implement the DDP on top of the Celluloid stack anyway. But what about running Reel in the Rails environment? Would we need "rails runner" for that? And we'd like to keep using the existing controllers to dispatch incoming requests (like, to add/change/remove resources). Is that even possible without having the request coming through Rack?
Any input is appreciated.
It's a bit late, but I've implemented DDP in Ruby, you can check it out here:
https://github.com/d-snp/ruby-ddp-server
It includes an implementation of EJSON as well. It's built on top of celluloid-websocket, and can be ran simply as a rack app.
I've made an integration with RethinkDB that can be used as a reference to build your own collections implementation.
https://github.com/d-snp/ruby-ddp-server-rethinkdb
I've also made a sample chat application that can be found here:
https://github.com/d-snp/celluloid-rethinkdb-chat
It's something that I have been longing to do as well, to integrate old "legacy" Rails code. Here is the best way I have found:
Since you would not be using any of Rails router/controller/views, but just the ability to read data and push it to the client, I recommend you use Rails to create JSON apis to the database, and deploy the code, then in Meteor you can consume the data via the http package, this would happen on the server at a regular interval and populate the MongoDB with the normalized data you need, then it would serve the browser client.
I am working on such an application that will keep a normalized version of the data in Mongo, and a relational version of the data in mySql (through Rails) this way I can preserve the legacy Rails functionality that I dont want to rewrite in JS, and get the benefit of Meteor for the one page that I need it most.

Independent app from rails

I am currently have a running site. However, I need to do some task to sync some data to my friend's site.
So that, I need another app for fetching data from my running app's DB and submit data to another site using a gem call mechanize.
My problem will be:
Do I need a whole Rails app to do the job? If not, what would be the best practice in my case?
Is there any easy way for accessing my running app's DB? For now, the only thing I know is AR.
Thanks
API
What you're looking for is an API -- a way to connect to a source of data & use that data in some other application:
In computer programming, an application programming interface (API)
specifies how some software components should interact with each other
APIs are actually very simple -- you have a series of endpoints which an application can connect to, pulling data, typically as JSON objects. As noted by Rajarshi Das, these endpoints will likely be based on the RESTful resource structure
Rails
Rails, by design, is very good at providing API's:
This Railscast shows how to use the rails-api gem to create a RESTful API that your other app can connect to

How to dynamically update client in rails when data in database changes?

I would like the data on a page to update as soon as it changes in database.
Is there a way I can trigger some event on server when data changes and send it to the client?
For example a user might see the number of friend requests he has and that number should update in realtime if some other user adds that user as a friend.
This is a brand new feature in Rails 4 (Server sent events). There is a Rails Cast on this topic.
If i m not wrong, then you are trying to write a Rails application in which a server can push data to multiple clients in real time.
Their are many guides that involve real-time push, and Rails 3.
Juggernaut
You can try juggernaut to do what you want.
The github repository : https://github.com/maccman/juggernaut Example of application with juggernaut : https://github.com/maccman/holla
Faye
Check out Faye: http://faye.jcoglan.com/ - I hear really good things about it.
if you're looking for a hosted solution, i've used Pusher http://pusher.com/ in the past, and loved it. i converted a site that used ajax polling over to pusher in about 30 minutes.
Ajax Push Engine - Complete Comet solution
You could use APE (Ajax Push Engine) Rails plugin.
APE is a full-featured OpenSource solution designed for Ajax Push. It includes a comet server and a Javascript Framework. APE allows to implement any kind of real-time data streaming to a web browser, without having to install anything on the client-side.
I hope this helps you.
Thanks

Consume SOAP web service in Ruby 1.9 and Rails 3?

I'm trying to consume a SOAP web service, (from SharePoint 2010 if it makes a difference). I'm using Ruby 1.9 and Rails 3. What is the best way to do this? I've read some stuff mentioning Savon http://savonrb.com/ but that is was too new and buggy. Is it still the best solution? Thanks.
I used Savon successfully to interact with the Bullhorn Staffing SOAP based service about six months ago. I didn't have any problems with the Savon Gem, all my headaches came from inconsistencies with the service.
My interactions with their service was limited to getting data (simple) and pushing data, which could include a resume file (more complex). I didn't have to look much further than the Savon doc to figure everything out, which I thought was simple to understand and easy to apply to my particular set of problems.
TLDR; 1 vote for Savon despite what you may have heard.
I used savon to interact with Jira SOAP API and it worked fine.

Resources