Class: Octo::Message::Message
- Inherits:
-
Object
- Object
- Octo::Message::Message
- Includes:
- MessageParser
- Defined in:
- lib/octocore/message_parser.rb
Overview
To handle message abstraction
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#eid ⇒ String
To get enterprise id.
-
#initialize(msg) ⇒ Message
constructor
Converting Message hash in Octo compatible form.
-
#to_h ⇒ Hash
To get hash message.
Methods included from MessageParser
Constructor Details
#initialize(msg) ⇒ Message
Converting Message hash in Octo compatible form
86 87 88 |
# File 'lib/octocore/message_parser.rb', line 86 def initialize(msg) = msg end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
82 83 84 |
# File 'lib/octocore/message_parser.rb', line 82 def end |
Instance Method Details
#eid ⇒ String
To get enterprise id
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/octocore/message_parser.rb', line 98 def eid msg = to_json enterprise = msg['enterprise'] raise StandardError, 'Parse Error' if enterprise.nil? eid = if enterprise.has_key?'custom_id' enterprise['custom_id'] elsif enterprise.has_key?'customId' enterprise['customId'] end eid end |
#to_h ⇒ Hash
To get hash message
92 93 94 |
# File 'lib/octocore/message_parser.rb', line 92 def to_h parse() end |