Codebase list libjira-rest-perl / 203d651
Update upstream source from tag 'upstream/0.020' Update to upstream version '0.020' with Debian dir b7358b2f94713513c867f952e65c661d242808ea gregor herrmann 4 years ago
12 changed file(s) with 142 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
00 Revision history for perl module JIRA-REST. -*- text -*-
1
2 0.020 2019-11-02 23:13:42-03:00 America/Sao_Paulo
3
4 [Documentation]
5
6 - Some fixes, a new reference to JIRA::REST::OAuth, a new example script
7 showing how to add a comment.
18
29 0.019 2018-07-28 18:00:17-03:00 America/Sao_Paulo
310
0 This software is copyright (c) 2018 by CPqD <www.cpqd.com.br>.
0 This software is copyright (c) 2019 by CPqD <www.cpqd.com.br>.
11
22 This is free software; you can redistribute it and/or modify it under
33 the same terms as the Perl 5 programming language system itself.
1111
1212 --- The GNU General Public License, Version 1, February 1989 ---
1313
14 This software is Copyright (c) 2018 by CPqD <www.cpqd.com.br>.
14 This software is Copyright (c) 2019 by CPqD <www.cpqd.com.br>.
1515
1616 This is free software, licensed under:
1717
271271
272272 --- The Artistic License 1.0 ---
273273
274 This software is Copyright (c) 2018 by CPqD <www.cpqd.com.br>.
274 This software is Copyright (c) 2019 by CPqD <www.cpqd.com.br>.
275275
276276 This is free software, licensed under:
277277
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009.
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
11 Changes
22 LICENSE
33 MANIFEST
66 Makefile.PL
77 README.pod
88 dist.ini
9 examples/comment_issue.pl
910 examples/create_issue.pl
1011 examples/edit_issue.pl
1112 examples/lib/JIRACLI.pm
33 "Gustavo L. de M. Chaves <gnustavo@cpan.org>"
44 ],
55 "dynamic_config" : 0,
6 "generated_by" : "Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010",
6 "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
77 "license" : [
88 "perl_5"
99 ],
6565 "web" : "https://github.com/gnustavo/jira-rest"
6666 }
6767 },
68 "version" : "0.019",
69 "x_serialization_backend" : "Cpanel::JSON::XS version 4.02"
68 "version" : "0.020",
69 "x_generated_by_perl" : "v5.28.1",
70 "x_serialization_backend" : "Cpanel::JSON::XS version 4.12"
7071 }
7172
77 configure_requires:
88 ExtUtils::MakeMaker: '0'
99 dynamic_config: 0
10 generated_by: 'Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010'
10 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
1111 license: perl
1212 meta-spec:
1313 url: http://module-build.sourceforge.net/META-spec-v1.4.html
3535 resources:
3636 homepage: https://metacpan.org/module/JIRA::REST
3737 repository: https://github.com/gnustavo/JIRA-REST.git
38 version: '0.019'
39 x_serialization_backend: 'YAML::Tiny version 1.70'
38 version: '0.020'
39 x_generated_by_perl: v5.28.1
40 x_serialization_backend: 'YAML::Tiny version 1.73'
0 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.009.
0 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
11 use strict;
22 use warnings;
33
3535 "Test::More" => 0,
3636 "lib" => 0
3737 },
38 "VERSION" => "0.019",
38 "VERSION" => "0.020",
3939 "test" => {
4040 "TESTS" => "t/*.t"
4141 }
0 #!/usr/bin/env perl
1
2 use 5.010;
3 use utf8;
4 use strict;
5 use warnings;
6 use FindBin;
7 use lib "$FindBin::Bin/lib";
8 use Getopt::Long::Descriptive;
9 use JIRACLI qw/get_credentials/;
10
11 my ($opt, $usage) = describe_options(
12 '%c %o',
13 ['jiraurl=s', "JIRA server base URL", {default => 'https://jira.cpqd.com.br'}],
14 ['issue|i=s', "Key of the issue to progress", {required => 1}],
15 ['comment|c=s', "Comment body", {required => 1}],
16 ['visibility' => 'hidden' => {'one_of' => [
17 ['group|g=s', "Group to restrict visibility to"],
18 ['role|r=s', "Role to restrict visibility to"],
19 ]}],
20 ['help|h', "Print usage message and exit"],
21 {show_defaults => 1},
22 );
23
24 if ($opt->help) {
25 print $usage->text;
26 exit 0;
27 }
28
29 my $jira = JIRA::REST->new(
30 $opt->jiraurl,
31 get_credentials(),
32 );
33
34 my $comment = {body => $opt->comment};
35
36 if (my $type = $opt->visibility) {
37 $comment->{visibility} = {
38 type => $type,
39 value => $opt->$type,
40 }
41 }
42
43 $jira->POST("/issue/@{[$opt->issue]}/comment", undef, $comment);
44
45 __END__
46 =encoding utf8
47
48 =head1 NAME
49
50 comment_issue.pl - Comment a JIRA issue
51
52 =head1 SYNOPSIS
53
54 comment_issue.pl [-ghir] [long options...]
55 --jiraurl STR JIRA server base URL
56 (default value: https://jira.cpqd.com.br)
57 -i STR --issue STR Key of the issue to progress
58 -c STR --comment STR Comment body
59 -g STR --group STR Group to restrict visibility to
60 -r STR --role STR Role to restrict visibility to
61 -h --help Print usage message and exit
62
63 =head1 DESCRIPTION
64
65 This script adds a comment to a JIRA issue.
66
67 =head1 OPTIONS
68
69 Common options are specified in the L<JIRACLI> documentation. Specific
70 options are defined below:
71
72 =over
73
74 =item * B<--issue STR>
75
76 Specifies the issue by its key (e.g. HD-1234).
77
78 =item * B<--comment STR>
79
80 The comment body.
81
82 =item * B<--group STR>
83
84 Use this option to restrict the comment visibility to the specified group.
85
86 =item * B<--role STR>
87
88 Use this option to restrict the comment visibility to the specified role.
89
90 Note that the B<--group> and B<--role> options are mutually exclusive.
91
92 =back
93
94 =head1 ENVIRONMENT
95
96 See the L<JIRACLI> documentation.
97
98 =head1 COPYRIGHT
99
100 Copyright 2019 CPqD.
101
102 This program is free software; you can redistribute it and/or modify
103 it under the same terms as Perl itself.
104
105 =head1 AUTHOR
106
107 Gustavo Chaves <gustavo@cpqd.com.br>
(No changes)
00 package JIRA::REST;
11 # ABSTRACT: Thin wrapper around Jira's REST API
2 $JIRA::REST::VERSION = '0.019';
2 $JIRA::REST::VERSION = '0.020';
33 use 5.010;
44 use utf8;
55 use strict;
8888
8989 # Since Jira doesn't send an authentication challenge, we force the
9090 # sending of the authentication header.
91 $rest->addHeader(Authorization => 'Basic ' . encode_base64("$args{username}:$args{password}"))
91 $rest->addHeader(Authorization => 'Basic ' . encode_base64("$args{username}:$args{password}", ''))
9292 unless $args{anonymous};
9393
9494 for my $ua ($rest->getUseragent) {
378378
379379 =head1 VERSION
380380
381 version 0.019
381 version 0.020
382382
383383 =head1 SYNOPSIS
384384
385385 use JIRA::REST;
386386
387387 my $jira = JIRA::REST->new({
388 URL => 'https://jira.example.net',
388 url => 'https://jira.example.net',
389389 username => 'myuser',
390390 password => 'mypass',
391391 });
438438
439439 =over
440440
441 =item * L<Jira Core REST API|https://docs.atlassian.com/jira/REST/server/>
441 =item * L<Jira Core REST API|https://docs.atlassian.com/software/jira/docs/api/REST/latest/>
442442
443443 This rich API superseded the old L<Jira SOAP
444444 API|http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html>
526526 called B<proxy> that is an extension to the REST::Client configuration and
527527 will be removed from the hash before passing it on to the REST::Client
528528 constructor. However, this argument is deprecated since v0.017 and you
529 should avoid it. Instead, use the following argument instead.
529 should avoid it. Use the following argument instead.
530530
531531 =item * B<proxy>
532532
567567 information about an issue you pass
568568 C</rest/servicedeskapi/request/$key/sla>.
569569
570 If you're using a method form Jira Core REST API you may omit the prefix
570 If you're using a method from Jira Core REST API you may omit the prefix
571571 C</rest/api/VERSION>. For example, to GET the list of all fields you may
572572 pass just C</field>.
573573
727727
728728 JIRA::REST uses a REST::Client object to perform the low-level interactions.
729729
730 =item * C<JIRA::REST::OAuth>
731
732 This module Sub Classes JIRA::REST providing OAuth 1.0 support.
733
730734 =item * C<JIRA::Client::REST>
731735
732736 This is another module implementing Jira's REST API using
746750
747751 =head1 COPYRIGHT AND LICENSE
748752
749 This software is copyright (c) 2018 by CPqD <www.cpqd.com.br>.
753 This software is copyright (c) 2019 by CPqD <www.cpqd.com.br>.
750754
751755 This is free software; you can redistribute it and/or modify it under
752756 the same terms as the Perl 5 programming language system itself.