How to create a ruby API for a java application [closed] - ruby

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a web application written mostly in Java. There are a few users that hope to use ruby to tailor this application to suit their own needs. How would I write an API that allows Ruby developers to interact with my application?
I'm really looking for some direction here - I know it's a broad question..

I think rmk has the right idea here, but I think rails is overkill. You've really got two feasible options:
The first option would be to leverage JRuby to allow them to provide JRE classes that you can interface with your code. They can write classes in ruby, compile them with JRuby, and you can deploy them with your app.
The other viable option would be to create a restful API using your existing java codebase and let them consume your api from ruby, much like rmk suggests. If you're providing a restful api, there's no need to add the overhead of jruby and rails unless you have some desire to.

You could write up a simple web service using JRuby + Rails.
Learn more about JRuby here: http://jruby.org/
The main advantage of using JRuby is that you will be able to leverage your existing Java code. The main advantage of using Ruby on Rails is that developing a web service will be a painless, even pleasurable experience.
And if you design your API in a RESTful manner, you can have Ruby programmers consume your API using ActiveResource
Resources:
Quick intro to JRuby on Rails: 120 second guide.
Great book if you want to get started: Ola Bini's Book

Related

dart as server web application or golang [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am planing to write an social network application and thinking about to use dart on backend. But I am asking me, if dart would be the right choice for backend application. I was searching in internet about this topic, but could not find something useful, that convince me to use dart for backend.
I am thinking to use golang, but I have to learn this language from zero. In dart I have some experience and really like dart language.
You know, I try make the right choice to use right tools, so I need some suggestions? Dart or golang?
I know, that java provide me hug ecosystem, but i don't like to learn java at all, just don't like java.
I would choose neo4j database, i am pretty sure, this suits for social network.
I don't like Java very much and developed a server in Go. I enjoyed working with Go a lot. Then I started with the client and because I also don't like JavaScript (in fact I hate it) I went with Dart which I like a lot. I already did a lot of server side work in Dart. A big advantage is that I can share code between client and sever, which is actually a lot in my current project.
I like Go better for server side development but I will stick with Dart for projects where I already use Dart for the client. It's just too difficult and time-consuming to stay up-to-date on two different languages (and ecosystem and libraries) for such new and fast evolving languages.
I think each language is a very good fit for this Job. Java has an awful lot of existing libs, tutorials, ... but most of the important things are covered in Go and Dart as well.
Basically I would say, stick with the language you know best. Learning a new language will impede your productivity for several months at least.
If you design your application in terms of loosely coupled modules then you can write(prototype) modules in Dart and if one day you will need to re-implement some of them in GO (for example you need better performance) it will be doable. Look at REST
Also it will make your application scalable and you will be able to expose API for separate modules (for example, if you need some of them as a phone app back-end or for the 3-d party developers)

Ruby GUI Development on Mac/Linux and Windows [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have following concern:
I should creat a application for a documentation tool (Tex/Word files to a final PDF). This tool requires a GUI and I would really love to write it in my fav programming lang Ruby.
The main problem while asking my friend google was: every question was asked 3+ years ago and/or the libraries are outdated.
So is there a nice way to get a GUI with Ruby on Mac/Linux and Windows (it would not bother me to create two different interfaces). Or are some better solutions out there (please no .java)
(Ruby on Rails could be a solution, but only browserbased ...)
Would be happy for your Ideas and Solutions :)
Best Regards
bMalum
I grepped #ruby channel logs and found that people often recommend Shoes framework for Ruby GUI apps.
Since Shoes makes use of JRuby, it requires Java to run. It shouldn't be a problem if your software is intended for regular people, as Java is installed on most computers anyway.
GitHub: https://github.com/shoes/shoes4
Some tutorial: http://pragtob.wordpress.com/2013/07/17/shoes-4-a-progress-report/
While there are some Ruby solutions for GUI, I would go for writing a Rails Web application and wrapping it with node-webkit instead. You will have a separate window for the application so it's kind of a native app, not a webapp. ;)
Please note you will need to bundle both node.js and Ruby binaries for the platforms you want to support. The most popular approach for node-webkit wrapped apps is AngularJS - then you don't have to bundle Ruby.
I have created a Gem LibUI for creating small GUI tools in Ruby. You can try it out if you like.
https://github.com/kojix2/libui

Which Ruby implementation is the most widely used? (MRI, Rubinius, JRuby etc.) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
As a novice to Ruby, I am a little bit confused as to which Ruby implementation is the most widely used in the industry.
I personally like to stay on the edge and therefore use MRI, but I get that a lot of people do not like it because of the GIL and prefer to use Rubinius instead, (which is pretty close to MRI), however I also gather that a lot of folks use JRuby (for Swing and such), however JRuby seems to be pretty far behind as far as Ruby development goes, (somewhere on the 1.9 line?).
Which implementation is the most commonly used in the industry?
For most straight forward projects, which don't require multi-threading, need to integrate with specific libraries, or run on certain containers - most people would prefer using the MRI implementation.
The main reason is that most ruby libraries are developed for MRI, and tested on them. You might have certain compatibility problems on other implementations.
Rubinius is preferred if you plan to work on a multi-threaded architecture, like under puma. JRuby also has better support for threads, and also has the rich library portfolio of the Java community. It is also preferred if you want to run on a java-based runtime container.

how to write and run a ruby web app on localhost, not rails? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I've read the tutorial but most are running rails guides on the web ?. I do not know how to run ruby on the web. help me !
You want to run it as CGI? Or running inside a wrapper? It really sounds like you don't have a good starting knowledge. I'd STRONGLY recommend taking time to learn more about all the technologies needed, such as how browsers interpret HTML, how back-end systems send HTML, plus serve images, CSS and JavaScript.
Start with Ruby and Sinatra, then grow from there:
require 'sinatra'
get '/hi' do
"Hello World!"
end
Load the Sinatra gem into your Ruby environment using gem install sinatra. Save the above code to a file, then run it using ruby /path/to/your/saved/file.rb. Follow the directions it outputs.
Ruby, unlike PHP, was not built with web in mind. It was made as a general programming language that can run just about anywhere. So you can't just boot up Apache and run Ruby code.
With that said, it is still possible to run your own Ruby code online. All you would need to do is write a web server that can listen and translate your code to something that is view-able from a web browser.
I would suggest not creating your own as there are a number of services built. If you are looking for something to put your Ruby code online, but don't want something as large as rails, I would suggest using Sinatra.

ruby 1.8.7 and web service [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm new to Ruby and want to write a web service using Ruby. Some constraints are:
Ruby 1.8.7
Windows 2008 Server
I found that the Sinatra gem may help. I want to know if there are any other options beside Sinatra.
Sinatra is a very easy-to-use way to go, and what I'd recommend to get your feet wet.
There are other solutions:
Padrino is built on-top of Sinatra, and offers additional functionality, but for your purposes Sinatra is still a more easily accessible way to go as you'll spend less time configuring.
Rails is the heavy-weight solution for Ruby, but if you are just learning the language then I'd recommend Sinatra still. Rails is very powerful but a lot of things it does will seem like magic, though they are actually based on standard Ruby features. So, I think you are still better off learning Ruby and working with Sinatra to get the basics.

Resources