Skip to content

Instantly share code, notes, and snippets.

@daz
Created December 16, 2010 05:32
Show Gist options
  • Save daz/743074 to your computer and use it in GitHub Desktop.
Save daz/743074 to your computer and use it in GitHub Desktop.
Skype status checker for Ruby
# Check Skype status. You need to enable 'Show my status on the web' in Skype prefs
#
# skype = SkypeStatus.new('some.username')
# skype.online?
# => true
require 'net/http'
require 'uri'
class SkypeStatus
attr_reader :status
attr_reader :username
def initialize(username)
@username = username.to_s
update!
end
def update!
@status = "Offline"
url = URI.parse("http://mystatus.skype.com/#{@username}.txt")
begin
@status = Net::HTTP.get(url)
rescue
end
end
def online?
@status == "Online"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment