Changes between Version 2 and Version 3 of XmlRpcPlugin/Ruby


Ignore:
Timestamp:
Sep 6, 2016, 6:53:08 PM (5 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • XmlRpcPlugin/Ruby

    v2 v3  
    1 === Using XMLRPC from Ruby ===
     1[[PageOutline(2-5,Contents,pullout)]]
    22
    3 You can either use the XMLRPC functionality included in the [http://ruby-doc.org/stdlib/libdoc/xmlrpc/rdoc/index.html Ruby Standard Library] or [/attachment/wiki/XmlRpcPlugin/trac4r.tar.gz download the trac4r library] which does all the trivial stuff for you.
     3= Using XMLRPC from Ruby
    44
    5 please refer to the '''SSL Support''' section if you need one.
     5You can either use the XML-RPC functionality included in the [http://ruby-doc.org/stdlib/libdoc/xmlrpc/rdoc/index.html Ruby Standard Library] or [/attachment/wiki/XmlRpcPlugin/trac4r.tar.gz download the trac4r library] which does all the trivial stuff for you.
    66
    7 ==== trac4r Example ====
     7Please refer to the '''SSL Support''' section if you need one.
     8
     9See also: XmlRpcPlugin
     10
     11== trac4r Example
     12
    813This example uses trac4r:
    9 {{{
    10 #!ruby
     14{{{#!ruby
    1115require 'trac4r'
    12 # initialize the connection (username and password can be ommitted if not needed, but most of the time you will need them if anonymous doesn't have XMLRPC permissions)
     16# initialize the connection: username and password can be omitted if not needed
     17# most of the time you will need them if anonymous doesn't have XML-RPC permissions
    1318trac = Trac.new "https://dev.example.com/trac/my_awesome_project", "myusername", "mypassword"
    1419# get a list of all tickets (as an array of numbers)
    1520trac.tickets.list :include_closed => true # this is the default anyway
    1621# get all the tickets
    17 # NOTE: the results here are cached, so you can call it as often as you want without producing traffic more than once.
     22# Note: the results here are cached, so you can call it as often as you want without producing traffic more than once.
    1823# use ":cached_results => false" to get the latest version
    1924trac.tickets.get_all :include_closed => true
     
    5661Also see the included Documentation in trac4r/doc
    5762
    58 If you need to do a custom query do
    59 {{{
    60 #!ruby
     63If you need to do a custom query do:
     64{{{#!ruby
    6165trac.query("system.getAPIVersion")
    6266}}}
    63 The first argument is the method name, all other arguments are directly passed to XMLRPC.
    64 For this example of cause you could do `trac.api_version` instead ;)
     67
     68The first argument is the method name, all other arguments are directly passed to XML-RPC.
     69For this example of course you could do `trac.api_version` instead.
    6570
    6671If you have any problems with trac4r you can email me: niklas.cathor (eat) gmail dot com
    6772
    68 ==== xmlrpc Example ====
     73== XML-RPC example
    6974
    7075An example using XML-RPC directly with Ruby to append to a wiki page:
    71 {{{
    72 #!ruby
     76{{{#!ruby
    7377require 'xmlrpc/client'
    7478user = "username"
     
    8387}}}
    8488
    85 ==== SSL Support + X509 ====
     89== SSL Support + X509
     90
    8691The standard ruby xmlrpc client for some reason does not support SSL at all.
    87 In order to be able to use the XMLRPC over SSL with both
     92To use the XML-RPC over SSL with both:
    8893 * Client Certificate authentication
    8994 * Basic Authentication
    90 One must do as follows.
    91 
    92 in order to proceed, you should have:
     95...you should have:
    9396 * ca certificate in .pem format
    9497 * personal certificate + RSA key in .p12 format (and its password, of course)
     
    102105~/.openssl/certkey.p12
    103106}}}
    104 ===== The Instructions =====
    105  1. apply the patches:
    106    1. to the [attachment:"xmlrpc-client.SSL.patch" xmlrpc client]
    107 {{{
     107
     108== Installation and Configuration
     109
     110 1. Apply the patches:
     111   1. To the [attachment:"xmlrpc-client.SSL.patch" XML-RPC client]:
     112{{{#!sh
    108113sudo su -
    109114cd /usr/lib/ruby/1.8/
    110115patch -p0  < /path/to/xmlrpc-client.SSL.patch
    111116}}}
    112    1. to the [attachment:"trac4r-1.2.3.SSL.patch" trac4r gem]
    113 {{{
     117   1. To the [attachment:"trac4r-1.2.3.SSL.patch" trac4r gem]:
     118{{{#!sh
    114119sudo su -
    115120cd /var/lib/gems/1.8/gems/
    116121patch -p0  < /path/to/trac4r-1.2.3.SSL.patch
    117122}}}
    118  1. create a .yml file called {{{~/.trac/creds.yml}}} of the following structure:
     123 1. Create a .yml file called {{{~/.trac/creds.yml}}} of the following structure:
    119124{{{
    120125---
     
    126131keypass: yourkeypassword
    127132}}}
    128    * do not forget to chmod the personal files to 600 or 400
    129  1. use the data in the code
    130 {{{
    131 #!ruby
     133   * Do not forget to chmod the personal files to 600 or 400.
     134 1. Use the data in the code:
     135{{{#!ruby
    132136require 'yaml'
    133137require 'openssl'
     
    156160}}}
    157161
    158 '''NOTE:''' The working environment of the code (trac4r + ssl) is:
     162'''Notes:''' The working environment of the code (trac4r + ssl) is:
    159163 * Debian/GNU system: {{{Linux hostname 2.6.26-2-686 #1 SMP Mon Jun 21 05:58:44 UTC 2010 i686 GNU/Linux}}}
    160164 * OpenSSL: {{{OpenSSL 0.9.8g 19 Oct 2007}}}