Class: Messages::MessageClass
- Inherits:
-
Object
- Object
- Messages::MessageClass
- Defined in:
- lib/yellowant/message/message_class.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#data ⇒ Object
Returns the value of attribute data.
-
#error ⇒ Object
Returns the value of attribute error.
-
#logs ⇒ Object
Returns the value of attribute logs.
-
#message_text ⇒ Object
Returns the value of attribute message_text.
Instance Method Summary collapse
- #attach(attachment) ⇒ Object
- #get_dict ⇒ Object
-
#initialize ⇒ MessageClass
constructor
A new instance of MessageClass.
- #to_json ⇒ Object
Constructor Details
#initialize ⇒ MessageClass
Returns a new instance of MessageClass.
8 9 10 11 12 13 14 |
# File 'lib/yellowant/message/message_class.rb', line 8 def initialize = '' = [] @data = {} @error = {} @logs = {} end |
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
7 8 9 |
# File 'lib/yellowant/message/message_class.rb', line 7 def end |
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/yellowant/message/message_class.rb', line 7 def data @data end |
#error ⇒ Object
Returns the value of attribute error.
7 8 9 |
# File 'lib/yellowant/message/message_class.rb', line 7 def error @error end |
#logs ⇒ Object
Returns the value of attribute logs.
7 8 9 |
# File 'lib/yellowant/message/message_class.rb', line 7 def logs @logs end |
#message_text ⇒ Object
Returns the value of attribute message_text.
7 8 9 |
# File 'lib/yellowant/message/message_class.rb', line 7 def end |
Instance Method Details
#attach(attachment) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/yellowant/message/message_class.rb', line 16 def attach() if !.is_a? MessageAttachment raise YellowantExceptions::YellowAntError, "Attachment must be MessageAttachment class" end << .get_dict end |
#get_dict ⇒ Object
28 29 30 |
# File 'lib/yellowant/message/message_class.rb', line 28 def get_dict {"message_text" => , "data"=> @data, "error" => @error, "attachments"=> , "logs"=> @logs} end |
#to_json ⇒ Object
23 24 25 26 |
# File 'lib/yellowant/message/message_class.rb', line 23 def to_json m = {"message_text" => , "data"=> @data, "error" => @error, "attachments"=> , "logs"=> @logs} JSON.generate(m) end |