Class: Kuroko2::Workflow::Notifier::Concerns::ChatMessageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ ChatMessageBuilder

Returns a new instance of ChatMessageBuilder.



6
7
8
9
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 6

def initialize(instance)
  @instance   = instance
  @definition = instance.job_definition
end

Instance Method Details

#additional_textObject



23
24
25
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 23

def additional_text
  "Failed to execute '#{@definition.name}' #{@definition.hipchat_additional_text}"
end

#failure_textObject



11
12
13
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 11

def failure_text
  "Failed to execute '#{@definition.name}'"
end

#finished_textObject



15
16
17
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 15

def finished_text
  "Finished to execute '#{@definition.name}'"
end

#job_instance_pathObject



27
28
29
30
31
32
33
34
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 27

def job_instance_path
  Kuroko2::Engine.routes.url_helpers.job_definition_job_instance_url(
    @definition,
    @instance,
    host: Kuroko2.config.url_host,
    protocol: Kuroko2.config.url_scheme,
  )
end

#long_elapsed_time_textObject



19
20
21
# File 'lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb', line 19

def long_elapsed_time_text
  "The running time is longer than expected '#{@definition.name}'."
end