Questions tagged [ruby-grape]

Grape lets you quickly add maven repository dependencies to your classpath OR Grape is a REST-like API micro-framework written in Ruby to sit on top of Rack.

Grape is a framework that allows for quickly defining REST-like interfaces in Ruby. It provides a DSL for defining versioned APIs as a collection of entities mounted on Rack.

385 questions
2
votes
1 answer

Grape - File Upload - Parameter declaration

I am writing my first API using Grape and am quite excited and it sounds and feels grate. Running through the notes I couldn't find a way to declare parameters for a file. Below is a work-in-progress class for providing profile details, updating…
Ziyan Junaideen
  • 3,270
  • 7
  • 46
  • 71
2
votes
1 answer

Versioning Grape active_model_serializer

I'm trying to make a V2 api for my rails app with grape and grape_active_model_serializer. But I can't figure how to make a serializer for each version of my api. Here is what my api look like app/api/api.rb : require 'grape-swagger' class API <…
2
votes
0 answers

How to expose associated record using grape entity

Hi I have a model Event and this event has one Setting. e.g class Event < ActiveRecord::Base has_one :setting end class Setting < ActieRecord::Base belongs_to :event end My event entity looks some thing like module Entities class…
2
votes
4 answers

NameError at /events path - Undefined Local Variable or Method

I'm quite new to rails and I'm using grape to build an API rails app. I've been getting this error message after I click on the 'Create Event' button :- NameError at /events undefined local variable or method `event_params' for…
oracle02
  • 55
  • 1
  • 10
2
votes
2 answers

Paperclip: The following errors were found: Image has contents that are not what they are reported to be

I am using paperclip with a rails app and always I get the following error: I, [2015-06-06T20:10:25.310071 #37358] INFO -- : Command :: file -b --mime '/tmp/58e53d1324eef6265fdb97b08ed9aadf20150606-37358-ouvtzl.png' I, [2015-06-06T20:10:25.317478…
Fran b
  • 3,016
  • 6
  • 38
  • 65
2
votes
1 answer

Wildcard route in Grape

I'm having issues getting Grape to respond to a purely wild card route. By that I mean that if I have a simple route defined as get do ... end I need to respond to all potential requests made to the API. The situation being I need to parse the…
sheppe
  • 708
  • 5
  • 12
2
votes
1 answer

How to use force_ssl with grape?

I am trying to create API using Grape gem for rails, but when I am trying to use force_ssl in my application controller, It gives me error "No function found force_ssl". I know this issue is occurring because Grape removes lot of modules from rails,…
2
votes
0 answers

Is my app secure? Token authentication with Rails and Angular

I have a Single Page Application in AngularJS with API in Ruby on Rails (Grape framework). My authentication system looks like this: User create an account. Sends information to server. Server save user in database and generate token with Devise.…
2
votes
2 answers

How to work with rack using ruby for storing image on cloudinary with gem carrierwave

I am using rack framework with active record and there is no rails , so when i upload an image to cloudinary using carrierwave gem i am getting the following error. Unexpected error while processing request: uninitialized constant …
2
votes
2 answers

How can I sign in user of devise in grape?

I use Grape to implement an API service of my app. But how can I call devise method sign_in in Grape?
WildCat
  • 1,961
  • 6
  • 24
  • 35
2
votes
1 answer

get response of grape endpoint with def after

I'm using Grape. I want to define a method that runs after the response value has been calculated for a request, I tried following this: http://www.sinatrarb.com/intro.html#Filters and ended up with: after do puts response end however response is…
user2333700
  • 127
  • 1
  • 5
2
votes
3 answers

Why does trying to use Grape with Rails fail with "uninitialized constant API"?

I would like someone to explain why this is happening in Rails (4.1.8) with Grape (0.10.1) so this is my API: app/api/root.rb: module API class Root < Grape::API prefix 'api' mount API::V1::Root end end app/api/v1/root.rb: module…
knowbody
  • 8,106
  • 6
  • 45
  • 70
2
votes
1 answer

Grape-swagger + Unable to read api 'users' from path url (server returned undefined) + ruby on rails

I am using Grape gem with rails app but I am getting below error when I call grape-swagger UI. Error : Unable to read api 'users' from path https://appname.herokuapp.com/api/swagger_doc.json/users.json (server returned undefined) Gem:: grape…
Chanu
  • 25
  • 5
2
votes
1 answer

How to extract data from a get request with Ruby Grape

I'm experimenting with grape and Ruby by trying to make a Yo API callback function. I can get simple examples up and running like this . . . resource :loc do get ':loc' do params.to_yaml end end How would I go about…
learnvst
  • 15,455
  • 16
  • 74
  • 121
2
votes
2 answers

Whats the way to define a test for a Grape API?

I'm trying to define a test environment to make request programmatically to my Grape API. I have the main API file into /app/api/services/v1.rb and i created a folder called requests into the spec path that have a file with this content for…
halbano
  • 1,135
  • 14
  • 34