Class: OnSIP::Session
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
Instance Method Summary
collapse
create, process_create_session_response, process_destroy_session_response
Constructor Details
#initialize(attributes = {}) ⇒ Session
Returns a new instance of Session.
6
7
8
|
# File 'lib/onsip/session.rb', line 6
def initialize(attributes = {})
@attributes = Hashie::Mash.new attributes
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4
5
6
|
# File 'lib/onsip/session.rb', line 4
def attributes
@attributes
end
|
Instance Method Details
#account ⇒ Object
26
27
28
|
# File 'lib/onsip/session.rb', line 26
def account
@account ||= self.user.account
end
|
#destroy! ⇒ Object
30
31
32
33
34
|
# File 'lib/onsip/session.rb', line 30
def destroy!
session = self.class.destroy!(self.id)
self.attributes.merge!(session.attributes)
self
end
|
#established? ⇒ Boolean
18
19
20
|
# File 'lib/onsip/session.rb', line 18
def established?
@attributes.IsEstablished && @attributes.IsEstablished.downcase == 'true'
end
|
#id ⇒ Object
10
11
12
|
# File 'lib/onsip/session.rb', line 10
def id
@attributes.SessionId
end
|
#user ⇒ Object
22
23
24
|
# File 'lib/onsip/session.rb', line 22
def user
@user ||= User.read(self.user_id)
end
|
#user_id ⇒ Object
14
15
16
|
# File 'lib/onsip/session.rb', line 14
def user_id
@attributes.UserId
end
|