Class: Sinbotra::Messenger::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/sinbotra/messenger/message.rb

Defined Under Namespace

Classes: Location, Sender

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg) ⇒ Message

Returns a new instance of Message.



17
18
19
# File 'lib/sinbotra/messenger/message.rb', line 17

def initialize(msg)
  @raw_message = msg
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/sinbotra/messenger/message.rb', line 10

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



15
16
17
# File 'lib/sinbotra/messenger/message.rb', line 15

def location
  @location
end

#postbackObject (readonly)

Returns the value of attribute postback.



13
14
15
# File 'lib/sinbotra/messenger/message.rb', line 13

def postback
  @postback
end

#senderObject (readonly)

Returns the value of attribute sender.



12
13
14
# File 'lib/sinbotra/messenger/message.rb', line 12

def sender
  @sender
end

#textObject (readonly)

Returns the value of attribute text.



14
15
16
# File 'lib/sinbotra/messenger/message.rb', line 14

def text
  @text
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



11
12
13
# File 'lib/sinbotra/messenger/message.rb', line 11

def timestamp
  @timestamp
end

Class Method Details

.load(msg) ⇒ Object



6
7
8
# File 'lib/sinbotra/messenger/message.rb', line 6

def self.load(msg)
  new(msg).parse
end

Instance Method Details

#parseObject



21
22
23
24
# File 'lib/sinbotra/messenger/message.rb', line 21

def parse
  parse_message
  self
end

#postback?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/sinbotra/messenger/message.rb', line 26

def postback?
  !!postback
end