Class: Handiv::Tasks::Reporter
- Inherits:
-
Object
- Object
- Handiv::Tasks::Reporter
- Defined in:
- lib/handiv/tasks/reporter.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
Instance Method Summary collapse
-
#initialize(client, task_id, options = {}) ⇒ Reporter
constructor
A new instance of Reporter.
- #report ⇒ Object
Constructor Details
#initialize(client, task_id, options = {}) ⇒ Reporter
Returns a new instance of Reporter.
6 7 8 9 10 |
# File 'lib/handiv/tasks/reporter.rb', line 6 def initialize(client, task_id, = {}) @client = client @task_id = task_id @options = .is_a?(String) ? { message: } : end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/handiv/tasks/reporter.rb', line 4 def client @client end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/handiv/tasks/reporter.rb', line 4 def @options end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
4 5 6 |
# File 'lib/handiv/tasks/reporter.rb', line 4 def task_id @task_id end |
Instance Method Details
#report ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/handiv/tasks/reporter.rb', line 12 def report client.logger.debug "Sending event about task #{task_id}" status = client.connection.send_data("tasks/#{task_id}", ) log_status(status) status >= 200 && status < 300 # Return success end |