Questions tagged [grape-api]

Grape is a Ruby Gem that provides a DSL to easily develop RESTful APIs.

Grape is a REST-like API micro-framework for Ruby. It’s designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs.

307 questions
0
votes
1 answer

Rspec with transactional_fixtures=true throws uniqueness errors

I'm testing my API, build with Grape and Rails, with RSpec and get a lot of uniqueness validation errors. I'm using config.use_transactional_fixtures = true to rollback the database after each test, but I'm getting this errors: 7) API GET…
Slevin
  • 4,268
  • 12
  • 40
  • 90
0
votes
1 answer

How do I force Grape to accept and return only JSON?

How do i restrict my API to accept & respond only json format on Rails & Grape, i've try format :json on my Grape controller and (for example) i can access it on example.com/api/v1/ping.json, but i also can access it via example.com/api/v1/ping.xml,…
user876349
0
votes
0 answers

How to pass query string and POST params in grape

I am using grape Restful API. I want to create a post method with POST parameters and Query string parameters. How to use them? Can anybody give me a nice example? I know to pass Query string params(key, sign) as follows. but how to use POST…
Sam
  • 5,040
  • 12
  • 43
  • 95
0
votes
0 answers

Grape::API – RuntimeError: Circular dependency detected while autoloading constant User

I'm testing the Grap API framework with Rails 4.1, but I'm stuck on this circlar dependency. Any idea why I get it? app/api/v1/user.rb module V1 class User < Grape::API format :json desc 'Returns pong.' get :user do { ping:…
martins
  • 9,669
  • 11
  • 57
  • 85
0
votes
0 answers

Is it possible to have duplicate HTTP GET query keys using Grape API?

I'm trying to create a custom REST API using Grape, but have hit a problem whereby I want to pass duplicate query string params for selected facets, such as /search?fq=category:freezer&fq=brand:hotpoint. The params object only has the last…
Pete
  • 1
  • 2
0
votes
2 answers

Rails4 + Json API : Increase detail of response

I'm a newbie on RoR (and Ruby). I need a little help about a json response (with Grape). This is the sample: { events: [ { 'some data':'some data', place_id: 1 } ] } Now this is the…
Luis C.
  • 727
  • 3
  • 22
  • 34
0
votes
3 answers

How to make a variable accessible through out the app

I have a variable assigned like this: cryptsy = Cryptsy::API::Client.new(key, secret) How can I make this variable accessible through out the application? Currently its in the Application controller, but I am using GRAPE gem to create a simple api.…
nahtnam
  • 2,659
  • 1
  • 18
  • 31
0
votes
1 answer

How to present one namespace model with grape-entity?

I have one namespace model like this : class Message::Notification < Message end And I define one entity like this: class Message::Notification < Grape::Entity expose :id end There is a error when present the model: present @notification,…
why
  • 23,923
  • 29
  • 97
  • 142
0
votes
1 answer

Generate JavaScript using the Grape API?

I am using the Grape framework to retrieve data, which is working great. I would also like to retrieve a JavaScript file using the API. For example: