Class: Agora::AgoraDynamicKey2::ServiceApaas
- Defined in:
- lib/agora/dynamic_key2/access_token.rb
Constant Summary collapse
- SERVICE_TYPE =
7- PRIVILEGE_ROOM_USER =
1- PRIVILEGE_USER =
2- PRIVILEGE_APP =
3
Instance Attribute Summary collapse
-
#role ⇒ Object
Returns the value of attribute role.
-
#room_uuid ⇒ Object
Returns the value of attribute room_uuid.
-
#user_uuid ⇒ Object
Returns the value of attribute user_uuid.
Attributes inherited from Service
Instance Method Summary collapse
-
#initialize(room_uuid = '', user_uuid = '', role = -1)) ⇒ ServiceApaas
constructor
A new instance of ServiceApaas.
- #pack ⇒ Object
- #unpack(data) ⇒ Object
Methods inherited from Service
Constructor Details
#initialize(room_uuid = '', user_uuid = '', role = -1)) ⇒ ServiceApaas
Returns a new instance of ServiceApaas.
127 128 129 130 131 132 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 127 def initialize(room_uuid = '', user_uuid = '', role = -1) super(SERVICE_TYPE) @room_uuid = room_uuid @user_uuid = user_uuid @role = role end |
Instance Attribute Details
#role ⇒ Object
Returns the value of attribute role.
120 121 122 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 120 def role @role end |
#room_uuid ⇒ Object
Returns the value of attribute room_uuid.
120 121 122 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 120 def room_uuid @room_uuid end |
#user_uuid ⇒ Object
Returns the value of attribute user_uuid.
120 121 122 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 120 def user_uuid @user_uuid end |
Instance Method Details
#pack ⇒ Object
134 135 136 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 134 def pack super() + Util.pack_string(@room_uuid) + Util.pack_string(@user_uuid) + Util.pack_int16(@role) end |
#unpack(data) ⇒ Object
138 139 140 141 142 143 |
# File 'lib/agora/dynamic_key2/access_token.rb', line 138 def unpack(data) _, data = super(data) @room_uuid, data = Util.unpack_string(data) @user_uuid, data = Util.unpack_string(data) @role, data = Util.unpack_int16(data) end |