Class: Agora::AgoraDynamicKey2::ServiceChat

Inherits:
Service
  • Object
show all
Defined in:
lib/agora/dynamic_key2/access_token.rb

Constant Summary collapse

SERVICE_TYPE =
5
PRIVILEGE_USER =
1
PRIVILEGE_APP =
2

Instance Attribute Summary collapse

Attributes inherited from Service

#privileges, #type

Instance Method Summary collapse

Methods inherited from Service

#add_privilege, #fetch_uid

Constructor Details

#initialize(uid = '') ⇒ ServiceChat



104
105
106
107
# File 'lib/agora/dynamic_key2/access_token.rb', line 104

def initialize(uid = '')
  super(SERVICE_TYPE)
  @uid = fetch_uid(uid)
end

Instance Attribute Details

#uidObject

Returns the value of attribute uid.



98
99
100
# File 'lib/agora/dynamic_key2/access_token.rb', line 98

def uid
  @uid
end

Instance Method Details

#packObject



109
110
111
# File 'lib/agora/dynamic_key2/access_token.rb', line 109

def pack
  super() + Util.pack_string(@uid)
end

#unpack(data) ⇒ Object



113
114
115
116
# File 'lib/agora/dynamic_key2/access_token.rb', line 113

def unpack(data)
  _, data = super(data)
  @uid, data = Util.unpack_string(data)
end