Esendex Ruby SMS SDK
Our Ruby SDK is an easy to use client for our REST API. This SDK is in the early stages of development but supports the primary requirements around sending and receiving messages as well as push notifications.
Requirements
- Ruby
- An internet connection
- An Esendex Account (create your account)
- To use the included Rails controller for Push Notifications you'll need Rails version 3 or greater
Installation
RubyGem
The Esendex Ruby SDK can be installed in the following ways:
From the command line
In your project's Gemfile
Source Code
You can access the source code of the Esendex Ruby SDK here
Usage
Setting Up
Before sending messages you need to configure the gem with your credentials. In a Rails app this would typically go into a file called esendex.rb in the config/initializers.
You can omit account reference and specify it when you instantiate an account object if you're using multiple accounts.
You can also specify these using the environment variables ESENDEX_USERNAME, ESENDEX_PASSWORD and ESENDEX_ACCOUNT.
Sending Messages
First instantiate an Account with the reference. You can omit the reference if you've already configured one to use in the Esendex.configure step. Then, call the send method on the account object with a hash describing the message. The return value is a batch_id you can use to obtain the status of the messages you have sent.
Multiple messages are sent by passing an array of Messages to the send_messages method