[Rt-commit] [svn] r814 - in RT-Client: . lib/RT
autrijus at pallas.eruditorum.org
autrijus at pallas.eruditorum.org
Mon May 3 02:06:25 EDT 2004
Author: autrijus
Date: Mon May 3 02:06:24 2004
New Revision: 814
Modified:
RT-Client/ (props changed)
RT-Client/lib/RT/Client.pm
Log:
----------------------------------------------------------------------
r4413 at not: autrijus | 2004-05-03T06:06:29.165094Z
* Unbreak Client library.
----------------------------------------------------------------------
Modified: RT-Client/lib/RT/Client.pm
==============================================================================
--- RT-Client/lib/RT/Client.pm (original)
+++ RT-Client/lib/RT/Client.pm Mon May 3 02:06:24 2004
@@ -40,6 +40,7 @@
# get / show -- single parameter means URI implicitly
my $user = $rt->get( 'users/autrijus' );
+ $rt->groups(3)->
# update / edit
my $group = $rt->edit(
URI => 'groups/3',
@@ -65,17 +66,20 @@
BEGIN {
my @delegate_map = qw(
- search list getFeed
- get show getEntry
- update edit updateEntry
- create insert createEntry
- delete remove deleteEntry
+ add createEntry
+ remove deleteEntry
+ search getFeed
+ update createUpdate
+
+ get getEntry
+ put updateEntry
+ describe getDescription
);
- while (my ($key1, $key2, $value) = splice(@delegate_map, 0, 3)) {
+ while (my ($key, $value) = splice(@delegate_map, 0, 2)) {
my $method = "SUPER::$value";
no strict 'refs';
- *$key1 = *$key2 = sub {
+ *$key = sub {
my $self = shift;
my %args = (@_ > 1) ? @_ : (URI => $_[0]);
return $self->can($method)->(
@@ -97,7 +101,7 @@
$uri = URI->new($uri);
@args{'Username', 'Password'} = split(/:/, $uri->userinfo||'', 2);
$args{Server} = $uri->scheme . '://' .$uri->host_port;
- $args{Path} = ($uri->path =~ m{^/+$}) ? $uri->path : '';
+ $args{Path} = ($uri->path =~ m{^/+$}) ? '' : $uri->path;
}
my $self = $class->SUPER::new(%args);
@@ -134,7 +138,7 @@
sub path {
my $self = shift;
$self->{path} = shift if @_;
- return $self->{path} || '/REST/2.0';
+ return $self->{path} || '/Atom/0.3';
}
sub realm {
@@ -160,12 +164,14 @@
sub server_realm {
my $self = shift;
my $req = HTTP::Request->new(GET => $self->server_uri);
+ $self->munge_request($req);
+
my $res = $self->{ua}->request($req);
my $wsse = $res->header('WWW-Authenticate')
or die "Bad RT server";
$wsse =~ /\bWSSE (?=.*\bprofile="UsernameToken").*?\brealm="(.*?)"/
- or die "Bad WWW-Authenticate";
+ or die "Bad WWW-Authenticate: $wsse";
return $1;
}
@@ -175,11 +181,12 @@
$req->header(
Accept => 'application/x.atom+xml, application/xml, text/xml',
);
+ return $req unless $self->realm;
return $self->SUPER::munge_request($req);
}
1;
# my $rt = RT::Client->new('http://root:password@localhost/');
-# print $rt->search('templates')->as_xml;
+# print $rt->search('Queues')->as_xml;
More information about the Rt-commit
mailing list