BZ-Client

 view release on metacpan or  search on metacpan

eg/nagios2bugzilla/talktobugzilla.pl  view on Meta::CPAN

290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    try { if ($delete) { $log->debug('Removing file: ' .$f->basename); $f->remove() }}
    catch { $log->warn(sprintf 'Failed to delete %s because: %s', $f->basename, $_) };
 
    # telling nagios
    nagios_comment( @{$params}{qw( HOSTNAME SERVICEDESC )}, $newbug );
 
    return 1
 
}
 
sub update_bug {
 
    my $f = shift;
    my $bug = shift;
    my $params = shift;
 
    # ignore closed bugs
    unless ( $bug->is_open() ) {
 
        $log->info('Bug is closed, not updating');

lib/BZ/Client/Bug.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    }
    $client->log('debug', $class . '::search: Found ' . join(',',@result));
    return wantarray ? @result : \@result
}
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'Bug.create', $params);
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Bug.update', $params, 'bugs');
 
}
 
sub update_see_also {
    my($class, $client, $params) = @_;
    $client->log('debug', $class . '::update_see_also: Updating See-Also');
    my $result = $class->api_call($client, 'Bug.update_see_also', $params);
    my $changes = $result->{'changes'};
    if (!$changes || 'HASH' ne ref($changes)) {
        $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
    }
    $client->log('debug', $class . '::update_see_also: Updated stuff');
    return wantarray ? %$changes : $changes
}
 
sub update_tags {
    my($class, $client, $params) = @_;
    $client->log('debug', $class . '::update_tags: Updating Tags');
    my $result = $class->api_call($client, 'Bug.update_tags', $params);
    my $changes = $result->{'changes'};
    if (!$changes || 'HASH' ne ref($changes)) {
        $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
    }
    $client->log('debug', $class . '::update_tags: Updated stuff');
    return wantarray ? %$changes : $changes
}

lib/BZ/Client/Bug/Attachment.pm  view on Meta::CPAN

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
        $params->{data} = BZ::Client::XMLRPC::base64->new($params->{data})
            if (exists $params->{data} and ref $params->{data} eq '');
    }
    my $result = $class->api_call($client, 'Bug.add_attachment', $params);
    my $ids = $result->{'ids'};
    $class->error($client, 'Invalid reply by server, expected attachment ID.')
        unless $ids;
    return wantarray ? @$ids : $ids
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Bug.update_attachment', $params, 'attachments');
}
 
 
## rw methods
 
sub id {
    my $self = shift;
    if (@_) {

lib/BZ/Client/BugUserLastVisit.pm  view on Meta::CPAN

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$BZ::Client::BugUserLastVisit::VERSION = '4.4004';
 
 
 
## functions
 
sub update {
    my($class, $client, $params) = @_;
    my $result = $class->api_call($client, 'BugUserLastVisit.update', $params);
    return wantarray ? @$result : $result
}
 
sub get {
    my($class, $client, $params) = @_;
    my $result = $class->api_call($client, 'BugUserLastVisit.get', $params);
    return wantarray ? @$result : $result
}

lib/BZ/Client/Component.pm  view on Meta::CPAN

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# These are in order as per the above
 
## functions
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'Component.create', $params);
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Component.update', $params, 'components');
}
 
sub delete {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Component.delete', $params, 'components');
}
 
1;

lib/BZ/Client/FlagType.pm  view on Meta::CPAN

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    my($class, $client, $params) = @_;
    my $result = $class->api_call($client, 'FlagType.get', $params);
    return wantarray ? %$result : $result
}
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'FlagType.create', $params, 'flag_id');
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'FlagType.update', $params, 'flagtypes');
}
 
1;
 
__END__
 
=pod

lib/BZ/Client/Group.pm  view on Meta::CPAN

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
## functions
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'Group.create', $params);
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Group.update', $params, 'groups');
}
 
sub get {
    my($class, $client, $params) = @_;
    my $result = $class->api_call($client, 'Group.get', $params);
    return wantarray ? %$result : $result
}

lib/BZ/Client/Product.pm  view on Meta::CPAN

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
## functions
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'Product.create', $params);
}
 
sub update {
    my($class, $client, $params) = @_;
    return $class->_returns_array($client, 'Product.update', $params, 'components');
}
 
# convenience function
sub _get_list {
    my($class, $methodName, $client) = @_;
    my $result = $class->api_call($client, $methodName);
    my $ids = $result->{'ids'};
    if (!$ids || 'ARRAY' ne ref($ids)) {

lib/BZ/Client/User.pm  view on Meta::CPAN

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    return wantarray ? @result : \@result
}
 
## methods
 
sub create {
    my($class, $client, $params) = @_;
    return $class->_create($client, 'User.create', $params);
}
 
sub update {
    my($class, $client, $params) = @_;
    $client->log('debug', $class . '::update: Updating.');
    if (defined $params->{'email_enabled'}) {
        if ($params->{'email_enabled'}) {
            $params->{'email_enabled'} = BZ::Client::XMLRPC::boolean::TRUE()
        }
        else {
            $params->{'email_enabled'} = BZ::Client::XMLRPC::boolean::FALSE()
        }
    }



( run in 0.357 second using v1.01-cache-2.11-cpan-05444aca049 )