Update upstream source from tag 'upstream/0.020'
Update to upstream version '0.020'
with Debian dir b7358b2f94713513c867f952e65c661d242808ea
gregor herrmann
4 years ago
0 | 0 | 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. | |
1 | 8 | |
2 | 9 | 0.019 2018-07-28 18:00:17-03:00 America/Sao_Paulo |
3 | 10 |
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>. | |
1 | 1 | |
2 | 2 | This is free software; you can redistribute it and/or modify it under |
3 | 3 | the same terms as the Perl 5 programming language system itself. |
11 | 11 | |
12 | 12 | --- The GNU General Public License, Version 1, February 1989 --- |
13 | 13 | |
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>. | |
15 | 15 | |
16 | 16 | This is free software, licensed under: |
17 | 17 | |
271 | 271 | |
272 | 272 | --- The Artistic License 1.0 --- |
273 | 273 | |
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>. | |
275 | 275 | |
276 | 276 | This is free software, licensed under: |
277 | 277 |
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. | |
1 | 1 | Changes |
2 | 2 | LICENSE |
3 | 3 | MANIFEST |
6 | 6 | Makefile.PL |
7 | 7 | README.pod |
8 | 8 | dist.ini |
9 | examples/comment_issue.pl | |
9 | 10 | examples/create_issue.pl |
10 | 11 | examples/edit_issue.pl |
11 | 12 | examples/lib/JIRACLI.pm |
3 | 3 | "Gustavo L. de M. Chaves <gnustavo@cpan.org>" |
4 | 4 | ], |
5 | 5 | "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", | |
7 | 7 | "license" : [ |
8 | 8 | "perl_5" |
9 | 9 | ], |
65 | 65 | "web" : "https://github.com/gnustavo/jira-rest" |
66 | 66 | } |
67 | 67 | }, |
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" | |
70 | 71 | } |
71 | 72 |
7 | 7 | configure_requires: |
8 | 8 | ExtUtils::MakeMaker: '0' |
9 | 9 | 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' | |
11 | 11 | license: perl |
12 | 12 | meta-spec: |
13 | 13 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
35 | 35 | resources: |
36 | 36 | homepage: https://metacpan.org/module/JIRA::REST |
37 | 37 | 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. | |
1 | 1 | use strict; |
2 | 2 | use warnings; |
3 | 3 | |
35 | 35 | "Test::More" => 0, |
36 | 36 | "lib" => 0 |
37 | 37 | }, |
38 | "VERSION" => "0.019", | |
38 | "VERSION" => "0.020", | |
39 | 39 | "test" => { |
40 | 40 | "TESTS" => "t/*.t" |
41 | 41 | } |
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> |
0 | 0 | package JIRA::REST; |
1 | 1 | # ABSTRACT: Thin wrapper around Jira's REST API |
2 | $JIRA::REST::VERSION = '0.019'; | |
2 | $JIRA::REST::VERSION = '0.020'; | |
3 | 3 | use 5.010; |
4 | 4 | use utf8; |
5 | 5 | use strict; |
88 | 88 | |
89 | 89 | # Since Jira doesn't send an authentication challenge, we force the |
90 | 90 | # 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}", '')) | |
92 | 92 | unless $args{anonymous}; |
93 | 93 | |
94 | 94 | for my $ua ($rest->getUseragent) { |
378 | 378 | |
379 | 379 | =head1 VERSION |
380 | 380 | |
381 | version 0.019 | |
381 | version 0.020 | |
382 | 382 | |
383 | 383 | =head1 SYNOPSIS |
384 | 384 | |
385 | 385 | use JIRA::REST; |
386 | 386 | |
387 | 387 | my $jira = JIRA::REST->new({ |
388 | URL => 'https://jira.example.net', | |
388 | url => 'https://jira.example.net', | |
389 | 389 | username => 'myuser', |
390 | 390 | password => 'mypass', |
391 | 391 | }); |
438 | 438 | |
439 | 439 | =over |
440 | 440 | |
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/> | |
442 | 442 | |
443 | 443 | This rich API superseded the old L<Jira SOAP |
444 | 444 | API|http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html> |
526 | 526 | called B<proxy> that is an extension to the REST::Client configuration and |
527 | 527 | will be removed from the hash before passing it on to the REST::Client |
528 | 528 | 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. | |
530 | 530 | |
531 | 531 | =item * B<proxy> |
532 | 532 | |
567 | 567 | information about an issue you pass |
568 | 568 | C</rest/servicedeskapi/request/$key/sla>. |
569 | 569 | |
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 | |
571 | 571 | C</rest/api/VERSION>. For example, to GET the list of all fields you may |
572 | 572 | pass just C</field>. |
573 | 573 | |
727 | 727 | |
728 | 728 | JIRA::REST uses a REST::Client object to perform the low-level interactions. |
729 | 729 | |
730 | =item * C<JIRA::REST::OAuth> | |
731 | ||
732 | This module Sub Classes JIRA::REST providing OAuth 1.0 support. | |
733 | ||
730 | 734 | =item * C<JIRA::Client::REST> |
731 | 735 | |
732 | 736 | This is another module implementing Jira's REST API using |
746 | 750 | |
747 | 751 | =head1 COPYRIGHT AND LICENSE |
748 | 752 | |
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>. | |
750 | 754 | |
751 | 755 | This is free software; you can redistribute it and/or modify it under |
752 | 756 | the same terms as the Perl 5 programming language system itself. |