Class: Intercom::PSA
- Inherits:
-
Object
- Object
- Intercom::PSA
- Defined in:
- lib/PSA.rb
Constant Summary collapse
- VOICES =
["Agnes","Albert","Alex","Bad News","Bahh","Bells","Boing","Bruce","Bubbles","Cellos","Deranged","Fred","Good News","Hysterical","Junior","Kathy","Pipe Organ","Princess","Ralph","Trinoids","Vicki","Victoria","Whisper","Zarvox"]
Instance Method Summary collapse
- #alert(length = 1) ⇒ Object
- #broadcast(msg, voice = nil) ⇒ Object
-
#initialize(uri) ⇒ PSA
constructor
A new instance of PSA.
Constructor Details
#initialize(uri) ⇒ PSA
Returns a new instance of PSA.
6 7 8 |
# File 'lib/PSA.rb', line 6 def initialize(uri) @uri = uri end |
Instance Method Details
#alert(length = 1) ⇒ Object
19 20 21 22 |
# File 'lib/PSA.rb', line 19 def alert(length=1) msg = "ah " * length broadcast(msg,"Bells") end |
#broadcast(msg, voice = nil) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/PSA.rb', line 10 def broadcast(msg,voice=nil) url = URI(@uri) msg = "#{msg} -v #{voice}" if voice url.query = URI.encode_www_form({:message=>"#{msg}"}) res = Net::HTTP.get_response(url) puts res.body if res.is_a?(Net::HTTPSuccess) end |