Class: OpenX::Services::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/openx/services/session.rb

Constant Summary collapse

@@endpoint =
'/LogonXmlRpcService.php'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Session

Returns a new instance of Session.



7
8
9
10
11
# File 'lib/openx/services/session.rb', line 7

def initialize(url)
  @url    = url
  @server = XMLRPC::Client.new2("#{@url}#{@@endpoint}")
  @id     = nil
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/openx/services/session.rb', line 4

def id
  @id
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/openx/services/session.rb', line 4

def url
  @url
end

Instance Method Details

#create(user, password) ⇒ Object



13
14
15
16
# File 'lib/openx/services/session.rb', line 13

def create(user, password)
  @id = @server.call('logon', user, password)
  self
end

#destroyObject



18
19
20
21
22
# File 'lib/openx/services/session.rb', line 18

def destroy
  @server.call('logoff', @id)
  @id = nil
  self
end