The Plivo Ruby helper simplifies the process of making Plivo API calls and generating Plivo XML. Please note that this is the legacy
version.
If you are looking for the latest
version, you can get it here.
Run the following command for a quick installation of the helper.
$ gem install plivo
Install the helper manually from Github.
$ git clone git://github.com/plivo/plivo-ruby.git
$ rake gem
$ gem install pkg/plivo
You can use plivo::RestAPI
to initialize a REST client that can make API requests to Plivo.
1
2
3
AUTH_ID = "<auth_id>"
AUTH_TOKEN = "<auth_token>"
p = RestAPI.new(AUTH_ID, AUTH_TOKEN)
The snippet below shows how you can send an SMS.
1
2
3
4
5
6
7
params = {
'src' => '1111111111',
'dst' => '2222222222',
'text' => 'Hello, how are you?'
}
response = p.send_message(params)
Check out Message API documentation for more details.
You can make outbound phone calls to landlines, mobiles, and SIP endpoints (e.g., softphones), in any of our 200+ coverage countries
1
2
3
4
5
6
7
8
params = {
'to' => '2222222222',
'from' => '1111111111',
'answer_url' => 'https://s3.amazonaws.com/static.plivo.com/answer.xml',
'answer_method' => 'GET'
}
response = p.make_call(params)
Check out Call API documentation for more details.
Take a look at the Ruby examples on GitHub.
Please report issues or submit patches using the Github Issue Tracker or Customer Support.
The Plivo Ruby Helper Library is written by the Plivo Team and is distributed under the MIT License.