PennySMS Muncher
A little bit of code to make PennySMS XML requests.
>> require 'penny_sms'
>> include PennySMSMuncher
>> req = PennySMS::XMLRequest.new(penny_sms_api_key, from_email, phone_number, body)
...
>> response = req.send_sms
... # PennySMSMuncher::PennySMS::Response object>> response.success?
=> true
>> response.status
=> "OK"
>> req = PennySMS::XMLRequest.new(penny_sms_api_key, from_email, '6175551234', body)
...
>> response = req.send_sms
... # PennySMSMuncher::PennySMS::Response object
>> response.status
=> error"
>> response.success?
=> false
>> response.fault_code
=> "500"
>> response.fault_name
=> "Error: unsupported cell number"
>> response.raw
=> <Net::HTTPOK 200 OK readbody=true>
>> response.raw.body
=> "<?xml version="1.0" ?><methodResponse><fault><value><struct><member><name>faultCode</name><value><i4>500</i4></value></member><member><name>faultString</name><value><string>Error: unsupported cell number</string></value></member></struct></value></fault></methodResponse>\n"
>> response.data
... # LibXML::XML::Document object
Here is the minimalist PennySMS doc: https://www.pennysms.com/docs_xml
Note on Patches/Pull Requests
- Go ahead and make the JSON work.
- And feel free to chat me up.
Copyright
Copyright © 2010 chris A. See LICENSE for details.