Jusibe Library for Ruby
Busibe is a ruby gem that consumes the services of Jusibe. With this library, you can access the SMS functionalities provided by Jusibe seamlessly.
Add this line to your application's Gemfile:
gem 'busibe'
And then execute:
$ bundle
Or install it yourself as:
$ gem install busibe
require "busibe"
# set configuration params
config = {
public_key: "PUBLIC_KEY",
access_token: "ACCESS_TOKEN"
}
# instantiate Client class
client = Busibe::Client.new(config)
# data needed to send sms
payload = {
to: "PHONE NUMBER",
from: "Sender's name",
message: "Do you love Ruby?"
}
begin
client.send_sms payload # return instance of Client
# OR
client.send_sms(payload).get_response # return response body
rescue Exception => e
puts e.message
end
{
"status": "Sent",
"message_id": "xeqd6rrd26",
"sms_credits_used": 1
}
begin
client.check_available_credits # return instance of Client
# OR
client.check_available_credits.get_response # return response body
rescue Exception => e
puts e.message
end
{
"sms_credits": "182"
}
message_id = "MESSAGE ID"
begin
# return instance of Client
client.check_delivery_status message_id
# OR
# return response body
client.check_delivery_status(message_id).get_response
rescue Exception => e
puts e.message
end
{
"sms_credits": "182"
}
# sends sms and returns response
client.send_sms_with_response(payload)
# makes request and returns response
client.check_available_credits_with_response
# makes request and returns response
client.check_delivery_status_with_response(message_id)
Bug reports and pull requests are welcome on GitHub at https://github.com/andela-bmakinwa/busibe.
To contribute to this work:
- Fork it here
- Create your feature branch
git checkout -b my-new-feature
- Commit your changes
git commit -am 'Add some feature'
- Push to the branch
git push origin my-new-feature
- Create a new Pull Request
- Wait
The gem is available as open source under the terms of the MIT License.