Class: Docusign::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/docusign/base.rb

Class Method Summary collapse

Class Method Details

.credentials(email, password, endpoint_url = nil) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/docusign/base.rb', line 53

def credentials(email, password, endpoint_url=nil)
  
  connection = Docusign::Credential::CredentialSoap.new
  
  # newly added by Nick for Heroku SSL
				#connection.options["protocol.http.ssl_config.verify_mode"] = OpenSSL::SSL::VERIFY_PEER
				#connection.options["protocol.http.ssl_config.ca_file"] = '/usr/lib/ssl/certs/ca-certificates.crt'
				connection.options["protocol.http.ssl_config.verify_mode"] = Docusign::Config[:verify_mode]
				connection.options["protocol.http.ssl_config.ca_file"] = Docusign::Config[:ca_file]
  
  connection.endpoint_url = endpoint_url if endpoint_url
  
  connection.(:email => email, :password => password).loginResult        
end

.login(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/docusign/base.rb', line 20

def (options={})
  
  connection  = Docusign::APIServiceSoap.new
  
  # newly added by Nick for Heroku SSL
				#connection.options["protocol.http.ssl_config.verify_mode"] = nil
				#connection.options["protocol.http.ssl_config.verify_mode"] = OpenSSL::SSL::VERIFY_PEER
				#connection.options["protocol.http.ssl_config.ca_file"] = '/usr/lib/ssl/certs/ca-certificates.crt'
				connection.options["protocol.http.ssl_config.verify_mode"] = Docusign::Config[:verify_mode]
				connection.options["protocol.http.ssl_config.ca_file"] = Docusign::Config[:ca_file]
  
  if options[:integrators_key]
    header = IntegratorsKeyAuthHeaderHandler.new(
      :email           => options.delete(:email),
      :integrators_key => options.delete(:integrators_key),
      :password        => options.delete(:password)
    )
  else
    header = AuthHeaderHandler.new(
      :user_name => options.delete(:user_name), 
      :password  => options.delete(:password)
    )
  end
  
  connection.headerhandler << header
  
  options.each do |key, value|
    connection.send("#{key}=", value)
  end
  
  connection
end