DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Ruslan has posted 2 posts at DZone. View Full User Profile

AvisoSMS

11.14.2009
| 2686 views |
  • submit to reddit
        //  JSON for http://avisosms.ru/solutions/ruby/
//  variable description on http://avisosms.ru/development/json/sendsms/
    # send SMS
    respond = JSON.parse(
               RestClient.post "https://api.avisosms.ru/sms/json/",
               { :username=>"<USERNAME>",
                 :password=>"<PASSWORD>",
                 :destination_address=>"70951234567",
                 :request_type=>'send_message',
                 :message=>"<SMS_TEXT_MESSAGE>",
                 :source_address=>"<YOUR_SENDER_ADDRESS>",
                 :flash=>'0'
               }.to_json


    # get SMS 
    status = JSON.parse(
               RestClient.post "https://api.avisosms.ru/sms/json/",
               { :username=>"<USERNAME>",
                 :password=>"<PASSWORD>",
                 :request_type=>'get_message_state',
                 :messageID=>"<messageId>",
               }.to_json
              )