Class: ThinkFeelDoEngine::Reports::Messaging
- Inherits:
-
Object
- Object
- ThinkFeelDoEngine::Reports::Messaging
- Defined in:
- app/models/think_feel_do_engine/reports/messaging.rb
Overview
Metadata for Coach-Participant messaging.
Constant Summary collapse
- COACH =
1
- PARTICIPANT =
2
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message) ⇒ Messaging
constructor
A new instance of Messaging.
- #report ⇒ Object
Constructor Details
#initialize(message) ⇒ Messaging
Returns a new instance of Messaging.
22 23 24 25 26 27 28 |
# File 'app/models/think_feel_do_engine/reports/messaging.rb', line 22 def initialize() @message = @sender = .sender @recipient = .recipient @participant = @sender.is_a?(Participant) ? @sender : @recipient @coach = @sender.is_a?(User) ? @sender : @recipient end |
Class Method Details
.all ⇒ Object
16 17 18 19 20 |
# File 'app/models/think_feel_do_engine/reports/messaging.rb', line 16 def self.all Message.all.map do || new().report end end |
.columns ⇒ Object
9 10 11 12 13 14 |
# File 'app/models/think_feel_do_engine/reports/messaging.rb', line 9 def self.columns %w( message_id study_id therapist_id sender_id sender recipient start_dt treatment_week day event_date event_time is_message_opened message_opened_at message_subject message_content ) end |
Instance Method Details
#report ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/models/think_feel_do_engine/reports/messaging.rb', line 30 def report { message_id: @message.id, study_id: study_id, therapist_id: coach_id, sender_id: sender_type, sender: sender_identifier, recipient: recipient_identifier, start_dt: participant_start_date, treatment_week: enrollment_week, day: enrollment_day, event_date: date_sent, event_time: time_sent.iso8601, is_message_opened: , message_opened_at: .try(:iso8601), message_subject: @message.subject, message_content: @message.body } end |