Class: AlphaMail::MessagePayload
- Inherits:
-
Object
- Object
- AlphaMail::MessagePayload
- Defined in:
- lib/alphamail.rb
Overview
Message payload class
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
-
#receiver_id ⇒ Object
Returns the value of attribute receiver_id.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
-
#initialize(project_id = 0, receiver_id = 0, sender = Contact.new('', ''), receiver = Contact.new('', ''), body = '') ⇒ MessagePayload
constructor
A new instance of MessagePayload.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(project_id = 0, receiver_id = 0, sender = Contact.new('', ''), receiver = Contact.new('', ''), body = '') ⇒ MessagePayload
Returns a new instance of MessagePayload.
38 39 40 41 42 43 44 45 |
# File 'lib/alphamail.rb', line 38 def initialize(project_id = 0, receiver_id = 0, sender = Contact.new('', ''), receiver = Contact.new('', ''), body = '') @project_id = project_id @receiver_id = receiver_id @sender = sender @receiver = receiver @body = body @body_json = '' end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
36 37 38 |
# File 'lib/alphamail.rb', line 36 def body @body end |
#project_id ⇒ Object
Returns the value of attribute project_id.
32 33 34 |
# File 'lib/alphamail.rb', line 32 def project_id @project_id end |
#receiver ⇒ Object
Returns the value of attribute receiver.
35 36 37 |
# File 'lib/alphamail.rb', line 35 def receiver @receiver end |
#receiver_id ⇒ Object
Returns the value of attribute receiver_id.
33 34 35 |
# File 'lib/alphamail.rb', line 33 def receiver_id @receiver_id end |
#sender ⇒ Object
Returns the value of attribute sender.
34 35 36 |
# File 'lib/alphamail.rb', line 34 def sender @sender end |
Instance Method Details
#to_json(*a) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/alphamail.rb', line 47 def to_json(*a) if @body.respond_to?('to_json') @body_json = @body.to_json end { 'project_id' => project_id, 'receiver_id' => receiver_id, 'sender_name' => sender.name, 'sender_email' => sender.email, 'receiver_name' => receiver.name, 'receiver_email' => receiver.email, 'body' => @body_json }.to_json(*a) end |