1

I am rails beginner working on a task to replace HTTParty with Faraday. So in codebase I call put/post/get based on the verb like so:

response = HTTParty.send(verb, url, http_options)

I am aware that Faraday provides an option to call them individually like so: Faraday.put(url) do |req|

Can I somehow abstract it, to call based on the verb.

Please let me know, if I can answer any questions.

Rishi Katyal
  • 175
  • 5
  • 15
  • 2
    Any reason why `Faraday.send(verb, url, http_options)` doesn't work for you? [Faraday usage](https://lostisland.github.io/faraday/usage/) seems to suggest this would be entirely acceptable. Maybe you are confused as to how this is working in `HTTParty`? In this case it is doing the exact same thing. – engineersmnky May 28 '20 at 20:57
  • 1
    Awesome! much thanks. ```Faraday.send(verb, url, http_options)``` seems to work just fine. – Rishi Katyal May 28 '20 at 21:11
  • 1
    Thats actually just `Object#send` which all objects in Ruby respond to. `"dlrow olleH".send(:reverse)` – max May 29 '20 at 06:43

0 Answers0