[Erp5-report] r14640 - /erp5/trunk/utils/oood/samples/rubyclient.rb

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 29 12:52:49 CEST 2007


Author: bartek
Date: Tue May 29 12:52:49 2007
New Revision: 14640

URL: http://svn.erp5.org?rev=14640&view=rev
Log:
Sample Ruby client for oood (by Jacek)

Added:
    erp5/trunk/utils/oood/samples/rubyclient.rb

Added: erp5/trunk/utils/oood/samples/rubyclient.rb
URL: http://svn.erp5.org/erp5/trunk/utils/oood/samples/rubyclient.rb?rev=14640&view=auto
==============================================================================
--- erp5/trunk/utils/oood/samples/rubyclient.rb (added)
+++ erp5/trunk/utils/oood/samples/rubyclient.rb Tue May 29 12:52:49 2007
@@ -1,0 +1,46 @@
+#!/usr/bin/python
+##############################################################################
+#
+# Copyright (c) 2002, 2006 Nexedi SARL and Contributors. All Rights Reserved.
+#                    Jacek Medrzycki <jacek at erp5.pl>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+require 'xmlrpc/client'
+require 'xmlrpc/base64'
+
+in_data = File.read '/home/jacekm/Dokumenty/cv.doc'
+enc_data = XMLRPC::Base64.encode in_data
+
+server = XMLRPC::Client.new2 'http://localhost:8008'
+result = server.call('generate',{'data'=>enc_data,'extension'=>'pdf'})
+
+if result[0] == 200:
+    out_data = XMLRPC::Base64.decode result[1]['data']
+    out_file = File.open('/home/jacekm/Dokumenty/cv.pdf','w')
+    out_file.print out_data
+    out_file.close
+else
+    print "Nie udalo sie", result[0], result[2]
+end




More information about the Erp5-report mailing list