Class: Agora::AgoraDynamicKey2::ServiceRtm

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

Constant Summary collapse

SERVICE_TYPE =
2
PRIVILEGE_JOIN_LOGIN =
1

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(user_id = '') ⇒ ServiceRtm

Returns a new instance of ServiceRtm.



65
66
67
68
# File 'lib/agora/dynamic_key2/access_token.rb', line 65

def initialize(user_id = '')
  super(SERVICE_TYPE)
  @user_id = user_id
end

Instance Attribute Details

#user_idObject

Returns the value of attribute user_id.



60
61
62
# File 'lib/agora/dynamic_key2/access_token.rb', line 60

def user_id
  @user_id
end

Instance Method Details

#packObject



70
71
72
# File 'lib/agora/dynamic_key2/access_token.rb', line 70

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

#unpack(data) ⇒ Object



74
75
76
77
# File 'lib/agora/dynamic_key2/access_token.rb', line 74

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