开发者

Help with curb-fu gem - their documentation is light

I'm using the curb-fu gem as my curl interface. I'm tr开发者_如何转开发ying to follow the grouptexting api for sending an sms message.

Here they give examples written in php: http://grouptexting.com/sms-gateway/sms-api-docs.html

And I can get that to work just fine.

curb-fu has almost no documentation, and I can't quite seem to get things working properly.

Looking at the grouptexting api examples written in php, can anyone help me translate that into ruby/curb-fu? Or, can someone point me to some more robust documentation for curb-fu?


The README contains several examples of using curb-fu. There's also a YARD-generated API documentation available.

It seems pretty straightforward to use for me.

This PHP example

<?php
$ch=curl_init('https://app.grouptexting.com/api/sending');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&phonenumber= 2125551234&subject=test&message=test message");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
print($data); /* result of API call*/
?>

in Ruby + curb-fu translates into

response = CurbFu.post('https://app.grouptexting.com/api/sending', {
  :user => "username", :pass => "userpassword",
  :phonenumber => "2125551234", :subject => "test",
  :message => "test message"
})
puts response.body
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜