Ovaj primer prikazuje kako se distributer, koristeći Ruby, povezuje na naš XML-RPC server, kreira hosting nalog i registruje domen.
Imajte u vidu da, zbog jasnijeg prikaza, primer ne sadrži upravljanje greškama.
Primer
Ispod se nalazi kod za navedeni primer.
visa kodskriv ut #!/usr/local/bin/ruby require 'xmlrpc/client' require 'pp' require 'time' global_username = 'user' global_password = 'pass' global_domain_server_url = "https://api.loopia.se/RPCSERV" domain = "anders-via-ruby-" + Time.now.to_i.to_s + ".se" contact = {'firstname' => 'Anders', 'lastname' => 'Andersson', 'company' => 'Loopia AB', 'street' => 'Kopparlundsvägen 7B', 'street2' => '', 'zip' => '72130', 'city' => 'Västerås', 'country_iso2' => 'se', 'orgno' => '556633-9304', 'phone' => '021-128222', 'cell' => '', 'fax' => '', 'email' => 'info@loopia.se'} client = XMLRPC::Client.new2(global_domain_server_url) response = client.call( "createNewAccount", global_username, global_password, domain, contact, false, false, true, "HOSTING_UNIX", "HOSTING_BUSINESS", true) pp "Account created: " + response