class Flowpi::Message

Constants

MESSAGE_TYPES

Public Class Methods

new(data = {}) click to toggle source
# File lib/flowpi.rb, line 58
def initialize(data = {})
  @data = data
end

Public Instance Methods

content() click to toggle source
# File lib/flowpi.rb, line 71
def content
  if @data['content'].kind_of?(Hash)
    content = @data['content']['text']
  else
    content = @data['content']
  end
  content.gsub(/[^a-z ]/i, '')
end
has_content?() click to toggle source
# File lib/flowpi.rb, line 62
def has_content?
  MESSAGE_TYPES.include?(@data['event'])
end
parse(line) click to toggle source
# File lib/flowpi.rb, line 66
def parse(line)
  @data = JSON.parse(line)
  self
end