问题标签 [faraday]
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.
ruby - 使用 Faraday Middleware 缓存来自 GitHub API 的响应
我正在尝试在已加星标的存储库上设置缓存,但我无法让 faraday_http_cache 或 faraday_middleway 的响应缓存与 Octokit 一起使用。
不知道在哪里可以缓存加星标的存储库。
ruby-on-rails - How to avoid Faraday request to encode get parameters?
I have the following code
Unfortunately the key param gets encoded as shown in the log in this way key=xxxxx%257xxxxxxxxx%252xxxx%253xxxx-xxxx, causing that the mapquest API respond to with an invalid key (due to the encoding as i tried with postman and it works)
The key param should be send without encoding the %, how can i avoid that this doesnt happen, i haven't found any parameter to change this behavior
Im using Faraday 0.9.0, ruby 2.0. I know i can use the mapquest library that relies on restclient gem but as i ve spent some time coding this it would be nice how to make it work with faraday
ruby-on-rails - 将法拉第响应体解析为 Nokogiri 对象
我考虑过从 Mechanize 切换到 Faraday,因为我提出了很多请求,而且似乎要快得多。但是,我找不到的是是否可以将响应主体解析为 Nokogiri 对象。这样做的机械化方法如下:
使用法拉第而不是机械化如何实现这一目标?
ruby - 在 Ruby ElasticSearch 客户端中设置法拉第超时
timeout
创建 Ruby 时是否可以设置法拉第传输的属性Elasticsearch::Client
?初始化实例时有传递块的范围Elasticsearch::Transport::Transport::Faraday
,但是在尝试以下操作时,我们只能从以下位置获得空的连接集__build_connections
:
关于我们应该如何实现这个块来设置超时的任何建议?
ruby - 如何在 Ruby 中存根 STDOUT 而不会引发警告错误?
我有一个要运行的测试来测试我在 Ruby 中接收到 STDOUT 的输出。
现在我的测试看起来像这样:
哪个有效并且测试通过了,但是感觉很hacky,并且您会收到有关已初始化常量的Ruby警告错误。
我知道你可以这样做:
但是你可以看到字符串有两个值会在每次运行测试时改变:时间(我可以用 TimeCop 修复但不喜欢)和运行的 id(在法拉第设置,我可以存根,但又一次:我不想...)
所以我要问的关键是:有没有办法 STDOUT.should_receive(:print).with(/[\s\S]+ INFO -- : get https:\/\/api.example.com\/success/)
在收据上做或做某种匹配?
如果有帮助,完整的代码在这里:https ://github.com/petems/oauth2/blob/faraday_debug/spec/oauth2/client_spec.rb#L123
ruby-on-rails - Gemfile Twitter + 法拉第
在我的 Gemfile
如果我跑
我明白了
Bundler 找不到 gem "faraday" 的兼容版本:在 Gemfile 中:
ruby - 法拉第的红宝石存根,无法让它工作
对不起标题,我太沮丧了,现在想不出更好的东西。
我有一个类,Judge
它有一个方法#stats
。这个stats方法应该向 api 发送一个 GET 请求并获取一些数据作为响应。我正在尝试对此进行测试并存根 stats 方法,以便我不执行实际请求。这是我的测试的样子:
这是我正在测试的课程:
这目前给了我一个错误:Faraday does not implement: get
那么你如何用法拉第存根呢?我见过这样的方法:
但我似乎无法以正确的方式应用它。我在这里想念什么?
ruby-on-rails - 如何在 Ruby 中使用 Mechanize 或 Faraday 发送 JSON 表单数据
我想从使用 JSON 数据设置似乎通过 AJAX 请求的自定义搜索参数的网站检索数据。传输的数据显示在 Firebug 中的 XHR->Request Payload 下:
该站点不传输任何 POST 参数,而仅传输此 JSON 编码数据以应用搜索条件。使用 Mechanize 将这些数据作为 post 参数传递是行不通的。
如何在 Ruby on Rails 中使用 Mechanize 或 Faraday 传输这些数据?
ruby-on-rails - Bundler 失败,因为它找不到兼容版本的法拉第 gem
我正在尝试安装一个instagram-ruby-gem
但捆绑器一直失败并出现此错误:
这是我的 Gemfile:
我正在使用这个特定的 fork,因为它修复了法拉第版本以与 Rails 4 兼容。请参阅此处的提交,但这里是更改:
我已经试过了bundle update
。那没有用。安装的唯一法拉第版本是faraday 0.9.0
.