Anyone who can suggest some good references for Httparty?
-
05-06-2021 - |
문제
Hey I am new to Httparty. I can fetch data but have problem posting using Httparty. Anyone who can suggest some good references for that? Thanks a bunch.
해결책
There aren't a lot of references out there for HTTParty. Primarily, the readme and examples in their github repo. You could potentially go through their code to get a feel as well. Here's a quick example of a post using the HTTParty mixin:
class Emailer
include HTTParty
base_uri 'api.emailer.com'
def send(username, password, to, subject, body)
options = { username: username,
password: password,
to: to,
subject: subject,
body: body }
post('/send', options)
end
end
While your question was about HTTParty, and I've had to use that in the past, I've generally liked Typheous better. You may want to take a peek at that. I'm sure there are plenty of other HTTP Clients out there too. Those are the two I've worked with, and I've tended to prefer Typheous.
제휴하지 않습니다 StackOverflow