Class: Tootsie::Tasks::NotifyTask

Inherits:
Object
  • Object
show all
Defined in:
lib/tootsie/tasks/notify_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ NotifyTask

Returns a new instance of NotifyTask.



6
7
8
9
10
# File 'lib/tootsie/tasks/notify_task.rb', line 6

def initialize(attributes = {})
  attributes = attributes.with_indifferent_access
  @url = attributes[:url]
  @message = attributes[:message]
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



22
23
24
# File 'lib/tootsie/tasks/notify_task.rb', line 22

def message
  @message
end

#urlObject

Returns the value of attribute url.



21
22
23
# File 'lib/tootsie/tasks/notify_task.rb', line 21

def url
  @url
end

Instance Method Details

#attributesObject



17
18
19
# File 'lib/tootsie/tasks/notify_task.rb', line 17

def attributes
  {:url => @url, :message => @message}
end

#execute!Object



12
13
14
15
# File 'lib/tootsie/tasks/notify_task.rb', line 12

def execute!
  Application.get.logger.info "Notifying #{@url} with message: #{@message.inspect}"
  HTTPClient.new.post(@url, @message)
end