Class: RubyD2L::Auth
- Inherits:
-
Object
- Object
- RubyD2L::Auth
- Defined in:
- lib/ruby-d2l/auth.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.connect(site_url) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/ruby-d2l/auth.rb', line 6 def self.connect(site_url) Savon::Client.new do wsdl.document = "#{site_url}/d2l/AuthenticationTokenService.asmx?WSDL" wsdl.endpoint = "#{site_url}/d2l/AuthenticationTokenService.asmx" #http.proxy = @@proxy_server if @@proxy_server != nil http.auth.ssl.verify_mode = :none end end |
.get_token ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby-d2l/auth.rb', line 29 def self.get_token username = RubyD2L.username password = RubyD2L.password # RETURNS THE AUTH TOKEN response = self.connect(RubyD2L.site_url).request :authenticate do soap.xml = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <AuthenticateRequest xmlns="http://desire2learn.com/security/token/2007/08"> <username>'+ username +'</username> <password>'+ password +'</password> <purpose>Web Service</purpose> </AuthenticateRequest> </soap:Body> </soap:Envelope>' end token = response.to_hash[:authenticate_response][:token] end |
Instance Method Details
#list_soap_actions(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby-d2l/auth.rb', line 15 def list_soap_actions(params) site_url = params[0] # Get available SOAP actions ap connect(site_url).wsdl.soap_actions # [ # [0] :authenticate, # [1] :authenticate2, # [2] :authenticate_with_app_token # ] end |