Class: Handiv::Tasks::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/handiv/tasks/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id, options = {}) ⇒ Reporter

Returns a new instance of Reporter.



6
7
8
9
# File 'lib/handiv/tasks/reporter.rb', line 6

def initialize(task_id, options = {})
  @task_id = task_id
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/handiv/tasks/reporter.rb', line 4

def options
  @options
end

#task_idObject (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

#reportObject



11
12
13
14
15
16
17
18
# File 'lib/handiv/tasks/reporter.rb', line 11

def report
  Handiv.logger.debug "Sending event about task #{task_id}"

  status = connection.send_data("tasks/#{task_id}", options)
  log_status(status)

  status == 200 # Return success
end