Skip to content

makinwab/busibe

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Busibe

Coverage Status Build Status Code Climate

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.

Installation

Add this line to your application's Gemfile:

gem 'busibe'

And then execute:

$ bundle

Or install it yourself as:

$ gem install busibe

Usage

Create a Client instance

require "busibe"

# set configuration params
config = {
  public_key: "PUBLIC_KEY",
  access_token: "ACCESS_TOKEN"
}

# instantiate Client class
client = Busibe::Client.new(config)

Send SMS

# 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
Sample response body
{
  "status": "Sent",
  "message_id": "xeqd6rrd26",
  "sms_credits_used": 1
}

Check Available Credits

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
Sample response body
{
  "sms_credits": "182"
}

Check Delivery Status

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
Sample response body
{
  "sms_credits": "182"
}

Other available methods
# 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)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/andela-bmakinwa/busibe.

To contribute to this work:

  1. Fork it here
  2. Create your feature branch git checkout -b my-new-feature
  3. Commit your changes git commit -am 'Add some feature'
  4. Push to the branch git push origin my-new-feature
  5. Create a new Pull Request
  6. Wait

License

The gem is available as open source under the terms of the MIT License.

About

A wrapper gem for Jusibe SMS service http://jusibe.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published