问题标签 [grape]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1479 浏览

ruby - 如何使用 Grape 配置 OmniAuth?

我正在使用下面的代码:

我究竟做错了什么?当我访问时,/auth/facebook我得到了一条丢失的路线。

0 投票
1 回答
998 浏览

ruby - PUT 方法在 API 的 RSpec 测试中返回 405

我正在使用 Goliath-Grape 构建 RESTful Web 服务器,并将 RSpec 用于 TDD。当进行 API PUT 调用 (/api/v1/users/:id) 以从浏览器更新现有记录时,我得到预期的 204 响应。

但是当我通过 RSpec 测试相同的 API 调用时,我得到了 405。响应头看起来像这样:

来自 api_spec.rb 的代码片段

更新方法的代码片段:

知道为什么它会在 RSpec 测试中中断。

谢谢

0 投票
2 回答
10079 浏览

groovy - 使用 @Grab 注解编译 Groovy 项目时出错

我正在用 Gradle 编译一个 Groovy 项目,但我注意到当我在代码中使用 @Grab 注释时,出现以下错误:

(这里的完整堆栈跟踪http://pastebin.com/0ty4jNct

我发现让它工作的唯一方法是将“groovy”和“ivy”模块添加到groovy类路径中,但我想避免这种情况,因为不推荐使用groovy类路径。

这是一个 Gradle 错误吗?还是有更好的方法来管理 @Grab 依赖项?

0 投票
1 回答
3044 浏览

ruby-on-rails - 使用 curl、params 数组测试 Rails 葡萄 API

我正在使用 curl 手动测试我的 Rails 应用程序葡萄 API。我想发送一个 [1,2,3] 数组作为请求查询参数,以便可以访问,例如:

我只找到了如何发送被解释为 hash的东西的线索。

对于如何使用 curl 发布数组的线索,我将不胜感激。

0 投票
2 回答
10607 浏览

groovy - Intellij IDEA 没有从 Groovy 项目中的 @Grab 导入依赖项

我正在处理一个 groovy 脚本,它使用 @Grab 注释导入依赖项。该脚本将在 IDEA 中运行,并从命令行运行。但是,在 IDE 中,导入显示为红色(无法解析),并且没有自动完成如此导入的类。

我正在通过代理访问公司存储库,该代理已在 IDEA 中配置为 Http 代理(该模块应该并且现在在我的本地 .m2 存储库中!)

任何人有任何想法(没有双关语!)?

我正在使用 IntelliJ IDEA 12.5 Ultimate (IU-129.1135)、JRE 1.7 和 Groovy 2.1.6

0 投票
1 回答
1625 浏览

groovy - Groovy grapes freeze after downloading artifacts

After updating my ubuntu system I have problem to run groovy grapes scripts. All dependecies are download but process is still running in about 100 %

I have ubuntu :

groovy version:

My simple script look like:

and output is:

0 投票
1 回答
643 浏览

heroku - Resque losing connection to redis on heroku

I'm running an app on heroku. The web worker is developed in the Grape framework.

As Grape doesn't have anything like config/initializers, I'm running a code like this before each access to Resque:

After a while the Resque worker stops picking up jobs from Redis, even though some are queued there. When running locally everything works fine.

Any idea what am I doing wrong? Or where should I put the Resque's Redis initialization?

0 投票
1 回答
338 浏览

groovy - Groovy Grape“没有主体的方法”错误

下面是一个代码片段,下面是错误。我做错了什么很明显吗?我对葡萄很陌生。

org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:cfwdUpdate.groovy:1:您定义了一个没有主体的方法。尝试添加一个主体,或者声明它是抽象的。

在行:1 列:1

0 投票
2 回答
1604 浏览

ruby-on-rails - 作为 JSON 与 Grape 的 Activerecord 关联

有没有一种简单的方法可以使用 Grape 微框架返回带有 JSON 关联的 activerecord 模型?

此代码段不起作用,User.includes(:address).to_json(include: :address)将被编码为 JSON 的两倍。(to_json反正我自己用这个方法感觉不对)

0 投票
2 回答
3679 浏览

ruby - 在 ruby​​ 中解析 Hashie::Mash 输出到 Json

我正在为使用葡萄创建的 API 获取 JSON 格式的用户输入。在一个特定的参数中,我给出了以下格式的 JSON 数组。

当我尝试打印“个人”属性时,它显示如下

有没有办法将属性解析为json格式?