Questions tagged [rocketpants]

At its core, RocketPants is a set of tools (built around existing toolsets such as ActionPack) to make it easier to build well-designed APIs in Ruby and more importantly, along side Rails

9 questions
1
vote
1 answer

How can I re-raise a Ruby exception in a Rails rescue_from statement?

My Rails 4 app uses RocketPants for its JSON API and Pundit for authorization. I have code in my /app/controllers/api/v1/base_controller.rb file to handle errors from Pundit. Whenever a user isn't authorized to update a resource, Pundit throws a…
Rob Sobers
  • 20,737
  • 24
  • 82
  • 111
1
vote
1 answer

Rails4 - How to inherit from RocketPants::Base while writing API?

I am trying to create API for my Rails app. I have these following controllers. I have the following inheritance /app/controllers/api/api_controller.rb module Api class ApiController < ApplicationController #…
LovingRails
  • 1,565
  • 2
  • 16
  • 30
1
vote
1 answer

Why would I get 2 different API responses from a staging and production environment in Rails 4.2?

So I'm querying an api in rails 4.2 with limit and offset parameters, and I get 2 different responses in staging and production environments - production errors out. Do you have any idea why it would work in one environment but not the other? …
Nona
  • 5,302
  • 7
  • 41
  • 79
0
votes
1 answer

Newrelic rpm does not work with Rails 5 + Rocketpant

I recently upgrade my Rails app from 4.2.5 to 5.0.2 Everything works fine except Newrelic RPM to track our API performance. On Rails 4.2.5, we are using a folk of the gem 'rocket_pants-rpm' to make Newrelic track Rocketpants API endpoint…
fuyi
  • 2,573
  • 4
  • 23
  • 46
0
votes
1 answer

Reference a method (with argument) in the Rocket Pants collection response?

Using the Rocket Pants gem for an API, I'm wanting to be able to return a custom value in the collection json. For example, I'm currently doing this: collection( current_user.prizes, include: { location: { only: [:title] } }, only:…
Wes Foster
  • 8,770
  • 5
  • 42
  • 62
0
votes
1 answer

rocketpant how to handle 404 routing error

I am using rocketpant for rest API implementation. From this doc I can see rocketpant has considered error handling in controller nicely. However, it seems like it does not consider routing error, so if the requested url has no route defined,…
fuyi
  • 2,573
  • 4
  • 23
  • 46
0
votes
2 answers

Custom Adapter to support RocketPant with Rails

I am using rocket_pants gem to build backend API https://github.com/Sutto/rocket_pants It have a specific format to output data: { "response":[ {"id":1,"title":"Object Title","description":"Object Description"}, …
Nazar Hussain
  • 5,102
  • 6
  • 40
  • 67
0
votes
1 answer

Adapting Sutto's RocketPants REST api with Ember.js

Ember.js expects a json response to contain the model object in the root of the json. RocketPants encodes it's models on an attribute called response with the objects as it's value. Also the metadata returned from RocketPants is in the root next to…
CleoR
  • 806
  • 6
  • 18
0
votes
1 answer

Unable to send post or put parameters using RocketPants client

I am writing an api client using the RocketPants gem and am trying to use HTTParty as included in the gem to read, create, update and destroy resources. Reading and destroying works just fine, but I am facing problems creating and updating resources…
Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115