Class: EventSender

Inherits:
Object
  • Object
show all
Defined in:
app/models/event_sender.rb

Overview

rubocop:todo Style/Documentation

Class Method Summary collapse

Class Method Details

.send_fail_event(request, reason, comment, batch_id) ⇒ Object


2
3
4
# File 'app/models/event_sender.rb', line 2

def self.send_fail_event(request, reason, comment, batch_id)
  send_state_event('fail', request, reason, comment, batch_id)
end

.send_pass_event(request, reason, comment, batch_id) ⇒ Object


6
7
8
# File 'app/models/event_sender.rb', line 6

def self.send_pass_event(request, reason, comment, batch_id)
  send_state_event('pass', request, reason, comment, batch_id)
end

.send_pick_event(well, purpose_name, message, options = nil) ⇒ Object


21
22
23
24
25
# File 'app/models/event_sender.rb', line 21

def self.send_pick_event(well, purpose_name, message, options = nil)
  hash = { eventful: well, family: PlatesHelper.event_family_for_pick(purpose_name), message: message,
           content: Date.today.to_s }
  create!(hash.merge(options || {}))
end

.send_request_update(request, family, message, options = nil) ⇒ Object


16
17
18
19
# File 'app/models/event_sender.rb', line 16

def self.send_request_update(request, family, message, options = nil)
  hash = { eventful: request, family: family, message: message }
  create!(hash.merge(options || {}))
end

.send_state_event(state, request, reason, comment, batch_id, user = nil) ⇒ Object


10
11
12
13
14
# File 'app/models/event_sender.rb', line 10

def self.send_state_event(state, request, reason, comment, batch_id, user = nil)
  hash = { eventful: request, family: state, content: reason, message: comment, identifier: batch_id,
           created_by: user }
  create!(hash)
end