Project

busibe

0.0
No commit activity in last 3 years
No release in over 3 years
Busibe provides an easy interface to interact with the Jusibe API (jusibe.com)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
>= 0
~> 10.0
~> 3.0
>= 0

Runtime

 Project Readme

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.