From e698452f3a2e5a04e291b880c2d823b098c0714a Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 1 Nov 2006 07:26:28 +0000 Subject: Bug 358703: WebService functions version and timezone should follow bugzilla standard Patch By Mads Bondo Dydensborg r=mkanat, a=myk --- Bugzilla/WebService/Bugzilla.pm | 51 ++++++++++++++++++++++++++++++----------- contrib/bz_webservice_demo.pl | 13 ++++++++++- 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm index 698dabbe8..1eeeebddc 100755 --- a/Bugzilla/WebService/Bugzilla.pm +++ b/Bugzilla/WebService/Bugzilla.pm @@ -14,24 +14,26 @@ # # Contributor(s): Marc Schumann # Max Kanat-Alexander +# Mads Bondo Dydensborg package Bugzilla::WebService::Bugzilla; use strict; use base qw(Bugzilla::WebService); use Bugzilla::Constants; +import SOAP::Data qw(type); use Time::Zone; sub version { - return BUGZILLA_VERSION; + return { version => type('string')->value(BUGZILLA_VERSION) }; } sub timezone { my $offset = tz_offset(); $offset = (($offset / 60) / 60) * 100; $offset = sprintf('%+05d', $offset); - return $offset; + return { timezone => type('string')->value($offset) }; } 1; @@ -42,11 +44,6 @@ __END__ Bugzilla::WebService::Bugzilla - Global functions for the webservice interface. -=head1 SYNOPSIS - - my $version = Bugzilla.version; - my $tz = Bugzilla.timezone; - =head1 DESCRIPTION This provides functions that tell you about Bugzilla in general. @@ -58,14 +55,42 @@ and B mean. =over -=item C +=item C B + +=over + +=item B -Returns the current version of Bugzilla, as a string. +Returns the current version of Bugzilla. -=item C +=item B (none) + +=item B + +A hash with a single item, C, that is the version as a +string. + +=item B (none) + +=back -Returns the timezone of the server Bugzilla is running on, in (+/-)XXXX -(RFC 2822) format. This is important because all dates/times that the -webservice interface returns will be in this timezone. +=item C B + +=over + +=item B + +Returns the timezone of the server Bugzilla is running on. This is +important because all dates/times that the webservice interface +returns will be in this timezone. + +=item B (none) + +=item B + +A hash with a single item, C, that is the timezone as a +string in (+/-)XXXX (RFC 2822) format. + +=back =back diff --git a/contrib/bz_webservice_demo.pl b/contrib/bz_webservice_demo.pl index 4b5562a0e..7b59a7efb 100755 --- a/contrib/bz_webservice_demo.pl +++ b/contrib/bz_webservice_demo.pl @@ -14,6 +14,7 @@ # The Original Code is the Bugzilla Bug Tracking System. # # Contributor(s): Marc Schumann +# Mads Bondo Dydensborg =head1 NAME @@ -145,7 +146,17 @@ minimum required version your application needs. $soapresult = $proxy->call('Bugzilla.version'); _die_on_fault($soapresult); -print 'Connecting to a Bugzilla of version ' . $soapresult->result() . ".\n"; +print 'Connecting to a Bugzilla of version ' . $soapresult->result()->{version} . ".\n"; + +=head2 Checking Bugzilla's timezone + +To make sure that you understand the dates and times that Bugzilla returns to you, you may want to call C. + +=cut + +$soapresult = $proxy->call('Bugzilla.timezone'); +_die_on_fault($soapresult); +print 'Bugzilla\'s timezone is ' . $soapresult->result()->{timezone} . ".\n"; =head2 Logging In and Out -- cgit v1.2.3-24-g4f1b