Class: OmahPluginSps
- Inherits:
-
Object
- Object
- OmahPluginSps
- Defined in:
- lib/omah-plugin-sps.rb
Instance Method Summary collapse
-
#initialize(settings: {address: 'localhost', port: 59000}, variables: {}) ⇒ OmahPluginSps
constructor
A new instance of OmahPluginSps.
- #on_newmail(messages, doc) ⇒ Object
Constructor Details
#initialize(settings: {address: 'localhost', port: 59000}, variables: {}) ⇒ OmahPluginSps
Returns a new instance of OmahPluginSps.
9 10 11 12 13 14 15 16 17 |
# File 'lib/omah-plugin-sps.rb', line 9 def initialize(settings: {address: 'localhost', port: 59000}, variables: {}) address, port = settings[:address], settings[:port] @sps = SPSPub.new(address: address, port: port) h = variables @email_address = h[:email_address] ? h[:email_address] : \ h[:user_name] + '@' + h[:address].split('.')[1..-1].join('.') end |
Instance Method Details
#on_newmail(messages, doc) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/omah-plugin-sps.rb', line 19 def on_newmail(, doc) m = 'message' m += 's' if .length > 1 fqm = "email/new: %s received %s new %s" \ % [@email_address, .length, m] @sps.notice fqm end |