Eztexting Gem
0.3.0
This is a gem built to make the eztexting api’s as easy to use as possible. They allow for use of all of what the API offers in a very easy and clear fashion.
Dependencies
This gem relies on HTTParty for making its requests. That is the only runtime dependency. The testing uses rspec and the documentation is written to be viewed with YARD.
API Calls Available These are the following calls available and their corresponding classes to use them
- SMS (Eztexting::Sms)
- Credit Purchase and Balance Check (Eztexting::Credits)
- Keyword Check and Configuration (Eztexting::Keyword)
- Carrier Lookups (Eztexting::Lookup)
- Voice Broadcast (Eztexting::Broadcast)
How To Use / How The Gem Is Setup
Basically all you need to do is call the connect method on the Eztexting module. Once thats done then your credentials are cached and you can use any of the classes to interact with the Eztexting service.
All API calls require your user name and password which is why you call the connect method and cache them. By doing this you enter your credentials once and then they merged with the options for the api call you want to make. This makes interacting with the Eztexting API far less irritating as there is no state or authentication and the credentials must be passed along through every request.
Examples
# Setup the connection for making requests.
Eztexting.connect!('username','password')
# => "credentials cached"
# Make a hash with the required keys of subject, message and phonenumber
# and then send out the SMS. Its that simple. 3 lines, 2 if you condense the creation of the Hash into the Method call
# The response will be an array , the first element will be the response mapped from the code to the literal that the Eztexting
# documentation lists out. The second element will be the raw value. In some cases this bit is important , in the credit balance
# check this would be the number of credits.
= {:subject => "testing out how awesome eztexting is", :phonenumber => "5555555555", :message => "Wow this is so simple and easy to use"}
Eztexting::Sms.single()
# => ["Message Sent",1]
# Check Your Credit Count
Eztexting::Credits.balance
# => ["The amount of plan and additional credits available", 54353]
# Check If A Keyword Is Available
Eztexting::Availablity.check("my_keyowrd_to_check")
# => ["The Keyword Is Available", 1]
# Make Voice Broadcast
= {:phonenumbers => 5555555555, :soundsource => "http://mywebsite.com/dunder_mifflin_is_a_part_of_sabre.wav", :callerid => 5555555555}
Eztexting::Voice.broadcast()
# => ["Campaign Sent",1]