Class: HipchatRoom

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/hipchat_room.rb

Instance Method Summary collapse

Instance Method Details

#accept_notify?(deploy) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/hipchat_room.rb', line 13

def accept_notify?(deploy)
  if deploy.job.failed? || deploy.job.errored?
    return always_notify?
  end

  if deploy.job.succeeded?
    return always_notify? || only_notify_suceeded?
  end

  # Other status, we will only notifiy if we enable always notify
  return always_notify?
end

#always_notify?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/models/hipchat_room.rb', line 5

def always_notify?
  return notify_on == "always"
end

#multi_message?Boolean

Check if we can send multi message to this room Our logic: notify_on = suceeded only has to be single message becase we will only notify on succeeded

Returns:

  • (Boolean)


29
30
31
# File 'app/models/hipchat_room.rb', line 29

def multi_message?
  return notify_on == "always"
end

#only_notify_suceeded?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/hipchat_room.rb', line 9

def only_notify_suceeded?
  return notify_on == "succeeded"
end