Questions tagged [faraday]

Simple, but flexible HTTP client library, with support for multiple backends.

Faraday is an HTTP client lib that provides a common interface over many adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle.

271 questions
0
votes
0 answers

How to push a variable into an API request body in Ruby?

I have a translation_api.rb file, and one of the body inputs is a text input, which I isolate in a function & name 'ticket_description'. However, when I use this variable in my 'make_request' method, the value is nil, and therefore the API returns…
user16741832
0
votes
1 answer

HMAC authorization for Faraday

I'm in the process of creating a ruby wrapper for an API, but they seem to be using some kind of weird authorization which isn't supported in Faraday so it seems that I have to create my own function to generate this. They have this on their…
Daniel
  • 183
  • 1
  • 7
0
votes
1 answer

RoR. Gem Faraday. How resend post query with body

Have the next problem: I get some post queries with the body (on http://api1.com/products) and validate it: products = JSON.parse(request.body.read) JSON::Validator.validate!(products_schema, products) If body data is validated, I try to resend it…
0
votes
1 answer

How to send json using faraday

I need to consume the linode api, in the description it says I have to send the data using curl like this curl -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -X POST -d '{ "label": "asdfasdf" …
Fernando
  • 61
  • 5
0
votes
1 answer

Error Response not parsed by Faraday despite adding :json middleware

I initialize my Faraday client this way: @client = Faraday.new(url: BASE_URL) do |faraday| faraday.request :json faraday.response :json faraday.response :raise_error end And when I rescue the Faraday::ClientError, the response's body looks…
Capripot
  • 1,354
  • 16
  • 26
0
votes
1 answer

faraday code for HTTPS request over HTTPS proxy

We prepare proxy server that listens to HTTPS on port 13128 at proxy.foo.com using self signed cert and want to request https://target-site.com over that proxy. curl request curl -v --proxy-cacert /path/to/proxy-cert.pem https://target-site.com/ -x…
yskkin
  • 854
  • 7
  • 24
0
votes
2 answers

Change non ascii character in an HTTP request

i have to make an http get call to an external service. By sending an address, the latitude and longitude coordinates are returned. The problem is that if the address is Russian or French I have errors like: URI must be ascii only…
Vito
  • 746
  • 2
  • 9
  • 25
0
votes
1 answer

Upload multiple files using Faraday

I'm trying to send a file array using Faraday with Rails. But when I send the files they arrive empty at the service that receives the files. Sending a single file works fine but with a array it doesn't. This is an example: def attachment if…
0
votes
1 answer

Rails app with Faraday: Problem refactoring Faraday::new() without url parameter

I'm refactoring some code in a Rails app consisting of several microservices. The faraday_middleware gem is used for communication between services. I managed to replace several calls to Faraday::new() in different helper files with one single call…
Pida
  • 928
  • 9
  • 32
0
votes
1 answer

How do I test whether a Sidekiq worker is sending the right data to an external API?

I have a Sidekiq worker that reaches out to an external API to get some data back. I am trying to write tests to make sure that this worker is designed and functioning correctly. The worker grabs a local model instance and examines two fields on the…
Erik Jacobs
  • 841
  • 3
  • 7
  • 19
0
votes
1 answer

Rails display only published episodes from Simplecast api

I'm running a rails application that calls Simplecasts API to display my podcast episodes. I followed a tutorial to setup the API services using Faraday. My question is how to only display published episodes on my index page? Normally, I would add a…
0
votes
1 answer

Aws SDK Ruby - retrieve credentials automatically when configuring Faraday

I enjoy using the AWS SDK without having to specify where to find the credentials, it makes it easier to configure on multiple environment where different types of credentials are available. The AWS SDK for Ruby searches for credentials [...] Is…
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
0
votes
1 answer

GET request with authorization header (with httparty or faraday)

I'm tring to use twitter api to fetch some data (Since https://github.com/sferik/twitter is not updaded anymore, some field that I need is left out) I can get Postman working with fields that I defined, i.e., authorization with Oauth 1.0, consumer…
ZK Zhao
  • 19,885
  • 47
  • 132
  • 206
0
votes
1 answer

How to send form data with Faraday and Rails 5?

I have the following Curl to send an attachment using Facebook Messenger API: curl \ -F 'recipient={"id":"1234567890"}' \ -F 'message={"attachment":{"type":"image", "payload":{}}}' \ -F…
0
votes
1 answer

Faraday Gem does not send fileData

I am doing an API automation in Ruby using the Faraday Gem to automate a file upload in my API. I have the follow problem: I need to upload the file as form-data, but it is not working. Here's the latest syntax that I'm using: conn =…