Class: OPQ::Msg

Inherits:
Object
  • Object
show all
Defined in:
lib/opqr/struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg) ⇒ Msg

Returns a new instance of Msg.



4
5
6
7
8
9
10
11
# File 'lib/opqr/struct.rb', line 4

def initialize(msg)
  @type = msg['CurrentPacket']['EventData']['MsgHead']['FromType']
  @from_uin = msg['CurrentPacket']['EventData']['MsgHead']['FromUin']
  @sender_uin = msg['CurrentPacket']['EventData']['MsgHead']['SenderUin']
  @text = msg['CurrentPacket']['EventData']['MsgBody']['Content']
  @msg_type = msg['CurrentPacket']['EventData']['MsgHead']['MsgType']
  @raw_json = msg
end

Instance Attribute Details

#from_uinObject

Returns the value of attribute from_uin.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def from_uin
  @from_uin
end

#msg_typeObject

Returns the value of attribute msg_type.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def msg_type
  @msg_type
end

#raw_jsonObject

Returns the value of attribute raw_json.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def raw_json
  @raw_json
end

#sender_uinObject

Returns the value of attribute sender_uin.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def sender_uin
  @sender_uin
end

#textObject

Returns the value of attribute text.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def text
  @text
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/opqr/struct.rb', line 12

def type
  @type
end