chikka
A Ruby gem for consuming the Chikka API for sending mesages
Requirements
Ruby 2.x.x
Installation
$ gem install chikka
Usage
Construct a Chikka::Client object and use the #send_message method to send a message. For example:
require 'chikka'
client = Chikka::Client.new(client_id:'key', secret_key:'secret', shortcode:'shortcode')
client.send_message(message:'This is a test', mobile_number:'639171234567')
By default, the client creates a random unique 32 character string as the message_id.
A message_id parameter can be specified and used for delivery notifications
client.send_message(message:'This is a test', mobile_number:'639171234567', message_id:'75c09eb7581588f578624ad9538cc6d3')
For replies, add a request_id and request_cost. request_cost defaults 'FREE'
client.send_message(message:'This is a test', mobile_number:'639171234567', request_id: '504830303...83137', request_cost: 'P5.00')
Production environment variables
Best practice for storing credentials for external services in production is to use environment variables, as described by 12factor.net/config. Chikka::Client defaults to extracting the client_id, secret_key and shortcode it needs from the CHIKKA_CLIENT_ID, CHIKKA_SECRET_KEY and CHIKKA_SHORTCODE environment variables if the options were not specified explicitly.
Contributing
- Fork it
- Create your feature branch (
git checkout -b new-feature
) - Commit your changes (
git commit -am 'Added awesome new features'
) - Push to the branch (
git push origin new-feature
) - Create new Pull Request
- ???
- Profit
MIT Open Source License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Acknowledgement
Originally created for use on Booky -Manila Restaurants