Commits

John Rizzo committed 01e6597

added script

  • Participants
  • Parent commits 392e0dd

Comments (0)

Files changed (5)

File .ruby-gemset

+twilio

File .ruby-version

+ruby-2.1.1

File bin/pingtest.rb

+require 'twilio_text'
+
+run_tests

File lib/twilio_text.rb

 require 'twilio_text/version'
 require 'twilio-ruby'
+require 'whenever'
 require 'net/ping'
 
 module TwilioText
-  account_sid = 'PNb7e63d0c794b36c42153b3c620ab00d2'
-  auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyy'
-  client = Twilio::REST::Client.new account_sid, auth_token
+  def run_test
+    account_sid = 'PNb7e63d0c794b36c42153b3c620ab00d2'
+    auth_token  = 'yyyyyyyyyyyyyyyyyyyyyyyyy'
+    client      = Twilio::REST::Client.new account_sid, auth_token
 
-  from = '+12012898785' # Your Twilio number
+    from = '+12012898785' # Your Twilio number
 
-  every 3.hours do
-    #runner 'MyModel.some_process'
-    #rake 'my:rake:task'
-    #command '/usr/bin/my_great_command'
+    every 1.minute do
+      #runner 'MyModel.some_process'
+      #rake 'my:rake:task'
+      #command '/usr/bin/my_great_command'
 
-    portal = 'portal.caxalt.com'
-    ping = Net::Ping::TCP.new(portal)
-    if p2.ping?
-      client.account.messages.create(
-        :from => from,
-        :to => key,
-        :body => "Hey #{value}, Monkey party at 6PM. Bring Bananas!"
-      )
-      puts "Sent message to #{value}"
-    else
-      puts portal + ' is not alive'
-    end
+      portal = 'portal.caxalt.com'
+      p2     = Net::Ping::UDP.new(portal)
+      if p2.ping?
+        client.account.messages.create(
+          :from => from,
+          :to   => key,
+          :body => "#{portal} is online!!!"
+        )
+        puts 'Sent message'
+      else
+        puts portal + ' is not alive'
+      end
 
+    end
   end
 end

File twilio_text.gemspec

   spec.email         = ['johnrizzo1@gmail.com']
   spec.summary       = %q{This is an app that will sms me upon successful host ping.}
   spec.description   = %q{This is an app}
-  spec.homepage      = 'My Homepage'
+  spec.homepage      = 'http://johnrizzo.net'
   spec.license       = 'MIT'
 
   spec.files         = `git ls-files -z`.split("\x0")