Project

infobeep

0.0
No commit activity in last 3 years
No release in over 3 years
Infobip (infobip.com) Ruby API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0

Runtime

 Project Readme

Infobeep

Ruby Gem for InfoBip SMS Services

Installation

Add this line to your application's Gemfile:

gem 'infobeep'

And then execute:

$ bundle

Or install it yourself as:

$ gem install infobeep

Usage

# Create Client
infobeep_client = Infobeep::Client.new('username', 'password')

# Create Request
infobeep_log_request = Infobeep::SMSLogRequest.new
infobeep_log_request.bulkId = 'id_of_bulk_sms_to_fetch_logs_for'

# Send Request and get response
log_request_response = infobeep_client.send_request(infobeep_log_request)

Supported Request Types

Infobeep::SMSRequest # Send a single message to several mobie numbers
Infobeep::BulkSMSRequest # Send multiple messages to multiple phone numbers
Infobeep::SMSLogRequest # Get sent SMS Logs
Infobeep::SMSReportRequest # Get SMS Delivery Reports
Infobeep::AccountBalanceRequest # Get account balance

Example: Send bulk SMS

infobeep_client = Infobeep::Client.new('username', 'password')

destinations = []
unique_id = 0
get_sms_message_recipients.each do |recipient|
    unique_id++
    infobeep_destination = Infobeep::SMSRequestDestination.new
    infobeep_destination.messageId = unique_id # leave blank to have Infobip API generate ID
    infobeep_destination.to = recipient.mobile_number
    destinations << infobeep_destination
end

infobeep_msg_request = Infobeep::SMSRequest.new
infobeep_msg_request.from = 'Sender Name'
infobeep_msg_request.text = 'Hello World!'
infobeep_msg_request.intermediateReport = true # Send intermediate delivery report updates
infobeep_msg_request.notifyUrl = 'https://www.bluebic.com/' # callback URL to receive intermediate delivery update
infobeep_msg_request.callbackData = {username: 'kheiron', token: SecureRandom.uuid}.to_json # data to append to delivery report updates
infobeep_msg_request.destinations = destinations

# send simple message
sms_request_response = infobeep_client.send_request(infobeep_msg_request)

# we can also create and send a Bulk SMS Request
infobeep_bulk_msg_request = Infobeep::BulkSMSRequest.new
infobeep_bulk_msg_request.bulkId = 'unique_id_for_message_group' # leave blank to have Infobip API generate
infobeep_bulk_msg_request.messages = [infobeep_msg_request] # Array of Infobeep::SMSRequest

bulk_sms_request_response = infobeep_client.send_request(infobeep_bulk_msg_request)

More Info

The code is simple to read and understand so that it also serves as documentaion.

For more Info see:

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/favour121/infobeep. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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