Roy Ashbrook

let go or be dragged
posts - 197, comments - 29, trackbacks - 8

March 2009 Entries

old ruby code for working with sugarcrm

Login and show basic info require 'soap/wsdlDriver' require 'digest/md5' u = "user" p = Digest::MD5.hexdigest("password") ua = {"user_name" => u,"password" => p} wsdl = "http://yoursite.com/soap.php?wsdl" #create soap s = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver #uncomment this line for debugging. saves xml packets to files #s.wiredump_file_base = "soapresult" #create session ss = s.login(ua,nil) #check for login errors if ss.error.number.to_i != 0 #status message puts "failed to login - #{ss.error.description}" #exit program exit else #get id sid = ss['id'] #get current user id uid = s.get_user_id(sid) #status message puts "logged in to session #{sid} as #{u} (#{uid}) " #logout s.logout(sid) #status message puts "logged out" end Adding an account After login, you can create new accounts using the code : module_name = "Accounts" ...

posted @ Sunday, March 15, 2009 8:01 PM | Feedback (1) | Filed Under [ DEV ]

Powered by: