grape-api

    0热度

    1回答

    我有一个命名空间模型是这样的: class Message::Notification < Message end 我定义一个实体是这样的: class Message::Notification < Grape::Entity expose :id end 有一个错误,当目前的模式: present @notification, with: Entities::Messag

    1热度

    1回答

    我试图创建一个使用Rails 4.0.4和0.7.0葡萄一个REST API的骨架,以这样的表现: 调用与特定版本的API: $ curl -H Accept=application/vnd.acme-v1+json http://localhost:3000/api/a “a-v1” $ curl -H Accept=application/vnd.acme-v1+json http://l

    2热度

    1回答

    我想在我的API中使用CanCan进行授权。我如何使用Grape :: API模块中的authorize!方法?现在,当我尝试使用它,它返回我: undefined method 'authorize!' for #<Grape::Endpoint:0xca39664>

    3热度

    2回答

    自定义标题PARAMS我用葡萄API和我需要编写自定义页眉测试 我的代码: it "should accept message" do post "/api/v1/my/route", post_data, secret: "ASDFGHJKL" last_response.status.should == 201 end 但路线得不到头可言, 我也试过heade

    1热度

    2回答

    我正在用Rails构建一个API。我用来创建API的宝石是葡萄和拉布尔。我做了很多工作,但现在我必须在所有来自api的json响应之前添加status标志。我怎么能这样做? 我有这个.rabl文件。 object @current_parent attributes :first_name => :name attributes :cell_phone => :mobile attribu

    2热度

    4回答

    当定义使用葡萄的API,有验证的存在和参数类型,例如一个非常方便的方法: params do requires :param1, type: String optional :param1, type: Integer end 但是我没有看到指定两个参数互斥的简便方法。 EG它会是这样的: params do requires :creatureName, ty

    0热度

    1回答

    我如何限制我的API接受&只在Rails上响应json格式&葡萄,我试过format :json在我的葡萄控制器上(例如)我可以在example.com/api/v1/ping.json上访问它,但我也可以通过example.com/api/v1/ping.xml,example.com/api/v1/ping.foobar访问它,并且扩展名列表继续... 我会喜欢做的是,在example.com

    2热度

    2回答

    我试图实现api版本控制,几乎与I've done here一样。但我似乎并没有得到模块/文件夹结构就在Rails应用程序,因为我得到这样V1 is not a module /app/api/v1/xml_responses/device.rb:3:in '<module:API>' 目录结构 /app /api - api.rb /v1 -base.r

    0热度

    3回答

    我已经这样分配的变量: cryptsy = Cryptsy::API::Client.new(key, secret) 我怎样才能使通过这个变量访问申请表? 目前它在应用程序控制器中,但我使用GRAPE gem来创建一个简单的api。我需要能够访问v1文件夹中/app/api/v1/bla.rb和其他文件中的变量。

    1热度

    3回答

    如果我在Grape API请求上设置参数验证,是否可以获得验证参数的哈希值? desc "My Grape API request handler" params do requires :name optional :description end post do puts params.inspect # has all the params passed