class Octo::Message::Message

To handle message abstraction

Attributes

message[R]

Public Class Methods

new(msg) click to toggle source

Converting Message hash in Octo compatible form @param [Hash] Message Hash

# File lib/octocore/message_parser.rb, line 86
def initialize(msg)
  @message = msg
end

Public Instance Methods

eid() click to toggle source

To get enterprise id @return [String] Enterprise Id

# 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() click to toggle source

To get hash message @return [Hash] Message Hash

# File lib/octocore/message_parser.rb, line 92
def to_h
  parse(@message)
end