What are the benefits of using Grape in the Rails app? [closed] - ruby-on-rails

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a Rails web app and I want to provide API. I have found Grape and it looked nice and it can also be mounted into Rails but I am not sure of benefits of mounting Grape into my Rails app and use it for API instead of Rails controllers.
As I understand Grape is great for building applications that provide only API but it is not my case.
What do you think are the benefits of using Grape in the Rails app and why should I do so?

Grape within Rails makes it easy to standardize the syntax of your API.
For example, parameter validation and coercion, error handling specific to your API that's different than what Rails provides out of the box, and easy shortcuts for typical responses.
You could do all this with Rails, of course. Grape just makes it easy.

Related

Ruby on Rails API Query [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am looking at creating a basic Rails application that can access this API http://instructure.github.io/ I have had a look through the documentation but cannot find anywhere I can get to grips with unfortunately. I am fairly new to Rails but I understand the basics. I was wondering if anyone knows of a good tutorial or resources where I can learn how to build a rails application that calls a third party API and displays the results. I know Canvas Instructure API is via JSON requests. Any information would be very much appreciated.
I would like to note that it uses Oauth2 for API authorisation for requests.
I would take a look at Httparty gem, It should do everything you need to consume an api
Here's an example of using omniauth and Httparty to connect to a 3rd party api
YOu can also take a look at oauth-plugin - https://github.com/pelle/oauth-plugin - which gives you both OAuth Provider and Consumer. Implementing the consumer should give you what you need.

Creating an API with Rails [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am just wondering what is the best approach in creating a RESTFUL API in Rails? Should I use Rails-API or Grape gem? What are the benefits/disadvantages of each? Is there a better alternative approach?
The good news is you can create REST APIs in Rails easily without either gem. There's a lot that goes into REST, so I don't think I can completely answer your question here. Fortunately, if you following Rails' conventions, you probably already have a REST API.
It looks like both of those gems are intended for cases where you are not using Rails. Rails-API says "The main example for its usage is in API applications only, where you usually don't need the entire Rails middleware stack nor template generation." Grape is designed for Rack applications, which offer a tiny bit of what Rails has to offer.
I would suggest taking a look at the book "Restful Web Services" by Richardson, Ruby, and Hansson. He does a good job of explaining REST and its advantages. The examples are in Rails, so it'll give you a great start to answering your question. I really enjoyed it and found it helpful in creating REST services in Rails.

Sample app using Ember Data and Rails backend [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Any sample app using ember data to recommend ? Ideally with Rails backend and models associations.
I have been using this app to follow as an example:
https://github.com/dgeb/ember_data_example
This blog post also has good direction:
Getting started with Ember Data and Rails
I was able to understand associations by looking at the Ember-Data project's documentation and tests:
I found this code very useful. Very well fragmented into individual files and a nicely written router.
Exactly mirroring the CRUD behavior.
https://github.com/bazzel/ember-sample2
Slightly outdated and simplistic, but I'll update this to revision 10 soon:
http://github.com/mehulkar/teams

What are some good resources for learning the Rails codebase internals? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been developing in Rails for about 3 years now, and would like to learn more about the Rails internals themselves. Rails 3 supposedly provides nice API's for integrating more closely with Rails, but I'm having a hard time finding documentation on how to use them. Here are some examples of what i'm looking for:
Rails Initialization Process
http://guides.rubyonrails.org/initialization.html
Arel Walkthrough
http://railscasts.com/episodes/239-activerecord-relation-walkthrough
Routing Walkthrough
http://railscasts.com/episodes/231-routing-walkthrough
http://railscasts.com/episodes/232-routing-walkthrough-part-2
Crafting Rails Applications
http://pragprog.com/book/jvrails/crafting-rails-applications
Are there any other good resources that an help as a guided tour of how Rails works?
(and please don't say read the source code.. I'm looking for a more guided explanation)
You may like this articles:
http://piotrsarnacki.com/2010/07/31/rails3-modularity/
http://piotrsarnacki.com/2010/06/18/rails-internals-railties/
But, you should start writing such articles by own, ie try to write how controllers instance variables are visible in views or prepare description of all rails modules and classes - this will make you much more familliar with rails.
The Ruby Metaprogramming Book has some chapters in the end teaching how ActiveRecord internals is made up.

to build a "quick" web backend for a mobile application, Ruby on Rails or Django? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I am currently in the process of building a mobile app, on iphone. I want the app to be able to connect to a web back-end server to manage user logins and to and retrieve user data. Which would be quicker/simpler to build that type of back-end RoR or Django?
Go with whichever you are most familiar with.
I can't answer about Django, but if you want to write it in Ruby, you should consider using Sinatra as a lightweight alternative to Rails.
If you choose django and are planning on handling RESTful requests from the phone, you should look into django-piston.

Resources