Class: OrangewireSender
- Inherits:
-
Object
- Object
- OrangewireSender
- Defined in:
- lib/orangewire_sender.rb
Constant Summary collapse
- @@host_url =
nil
- @@login =
nil
- @@password =
nil
Class Method Summary collapse
- .host_url=(url) ⇒ Object
- .login=(login) ⇒ Object
- .notify(headline, summary) ⇒ Object
- .password=(password) ⇒ Object
- .resource ⇒ Object
Class Method Details
.host_url=(url) ⇒ Object
26 27 28 |
# File 'lib/orangewire_sender.rb', line 26 def host_url=(url) @@host_url = url end |
.login=(login) ⇒ Object
30 31 32 |
# File 'lib/orangewire_sender.rb', line 30 def login=(login) @@login = login end |
.notify(headline, summary) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/orangewire_sender.rb', line 11 def notify(headline, summary) begin resource.post({ :headline => headline, :summary => summary, :login => @@login, :password => @@password }) rescue Orangewire::Base => b raise b rescue raise Orangewire::ConnectionError, "Error posting to #{@@host_url}", $@ end end |
.password=(password) ⇒ Object
34 35 36 |
# File 'lib/orangewire_sender.rb', line 34 def password=(password) @@password = password end |
.resource ⇒ Object
21 22 23 24 |
# File 'lib/orangewire_sender.rb', line 21 def resource raise Orangewire::ConfigError, "Please set host_url, login and password" unless valid_config? @resource ||= RestClient::Resource.new("#{@@host_url}/notifications") end |