A Ruby client that allows you to send SMS messages via Unifonic.
See Messages section in the Api Documentation to learn about the available actions.
Note: All and only the messages methods are supported plus the account's get balance method.
Add this line to your application's Gemfile:
gem 'unifonic_sms'
And then execute:
$ bundle
Or install it yourself as:
$ gem install unifonic_sms
First make an initializer unifonic_sms.rb
inside config/initializers
and add the configurations
UnifonicSms.configure do |config|
config.api_key = "xxxxxx-xxxxxxxxx-xxxxxx-xxxxxxxxxx"
config.sender_phone = "1234567890123"
end
Then start using the available module methods
# Get Account Balance.
UnifonicSms.balance
# Send SMS Message.
UnifonicSms.send_message("+012347647843", "Test Message Body")
# Send Bulk SMS Messages.
UnifonicSms.send_bulk("12347647843, 12391283123, 1209831923, 12031293102", "Test Message Body")
# Get SMS Message Status.
UnifonicSms.message_status(3902) # message_id
# Get SMS Messages Report.
UnifonicSms.messages_report
# Get SMS Message Details.
UnifonicSms.messages_details
# Get Schedualed SMS Messages.
UnifonicSms.schedualed_messages
# Stop Schedualed SMS Message.
UnifonicSms.stop_schedualed_messages(3902) # message_id
# Create Keyword.
UnifonicSms.keyword("127318923789", "google", "www.google.com")
# Get Inbox Messages.
UnifonicSms.inbox("127318923789")
# Get Pricing Details.
UnifonicSms.pricing("KSA") # Country Code
By default calls are stubbed, If you want to disable the stubbing you must make @mock_test
equal false
in the spec_helper.rb
file, Then make sure to set all the other variables in the spec_helper.rb
file to real values.
You must have Yard gem installed.
yardoc
Documentation will be generated in /docs
-
Fork it.
-
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 new Pull Request
The gem is available as open source under the terms of the MIT License.