Skip to content
Snippets Groups Projects
Commit d5b2f830 authored by Anton Soldatov's avatar Anton Soldatov
Browse files

Fixes in documentation

parent 80b46f64
No related branches found
No related tags found
No related merge requests found
...@@ -34,33 +34,33 @@ Redminer - Wrapper for RedMine REST API (http://www.redmine.org/projects/redmine ...@@ -34,33 +34,33 @@ Redminer - Wrapper for RedMine REST API (http://www.redmine.org/projects/redmine
# pass => 'p@s$w0rD', # pass => 'p@s$w0rD',
#); #);
my $project = $redminer->createProject({ my $project = $redminer->createProject({ project => {
identifier => 'my-project', identifier => 'my-project',
name => 'My Project', name => 'My Project',
description => 'My project, created with *Redminer*', description => 'My project, created with *Redminer*',
}); }});
if (!$project) { if (!$project) {
say STDERR 'Error(s) creating project: ', join("\n", map { $_ } $redminer->errorDetails->{errors}); say STDERR 'Error(s) creating project: ', join("\n", map { $_ } @{ $redminer->errorDetails->{errors} });
exit 1; exit 1;
} }
my $project_id = $project->{project}{id}; my $project_id = $project->{project}{id};
$redminer->updateProject($project_id, { $redminer->updateProject($project_id, { project => {
parent_id => 42, # Make a project with numeric ID 42 parent for $project_id parent_id => 42, # Make a project with numeric ID 42 parent for $project_id
inherit_members => 1, # Inherit all members and their permissions from the parent inherit_members => 1, # Inherit all members and their permissions from the parent
}); }});
my $issue = $redminer->createIssue({ my $issue = $redminer->createIssue({ issue => {
project_id => $project_id, project_id => $project_id,
subject => 'Test issue for Redminer', subject => 'Test issue for Redminer',
description => 'Issue description', description => 'Issue description',
}); }});
$redminer->deleteProject($project_id); $redminer->deleteProject($project_id);
=head1 DESCRIPTION =head1 DESCRIPTION
This module provides a thin client for RedMine REST API. Please note that although This module is a client for RedMine REST API. Please note that although
RedMine API is designed to support both JSON and XML, this module is B<JSON only>. RedMine API is designed to support both JSON and XML, this module is B<JSON only>.
=head1 METHODS NAMING AND OTHER CALL CONVENTIONS =head1 METHODS NAMING AND OTHER CALL CONVENTIONS
...@@ -125,7 +125,7 @@ All methods are dynamically converted to actual HTTP requests using following co ...@@ -125,7 +125,7 @@ All methods are dynamically converted to actual HTTP requests using following co
=head2 Complex Object Names =head2 Complex Object Names
Such complex names as C<TimeEntry> which should be dispatched to C<time_entries> Such complex names as C<TimeEntry> which should be dispatched to C<time_entries>
are recognized and thus can be spelled in a natural language way (see examples above). are recognized and thus can be spelled in CamelCase (see examples above).
If this is not the case, please report bugs. If this is not the case, please report bugs.
=head2 Return Values =head2 Return Values
...@@ -134,7 +134,7 @@ All successfull calls return hash references. For C<update*> and C<delete*> call ...@@ -134,7 +134,7 @@ All successfull calls return hash references. For C<update*> and C<delete*> call
hash references are empty. hash references are empty.
If a call fails, C<undef> is returned. In this case detailed error information can If a call fails, C<undef> is returned. In this case detailed error information can
be retrieved like this: be retrieved using C<errorDetails> method:
if (!$redminer->deleteIssue(42)) { if (!$redminer->deleteIssue(42)) {
my $details = $redminer->errorDetails; my $details = $redminer->errorDetails;
...@@ -175,7 +175,7 @@ B<no_wrapper_object>: Automatically add/remove wrapper object for data. See belo ...@@ -175,7 +175,7 @@ B<no_wrapper_object>: Automatically add/remove wrapper object for data. See belo
=head3 no_wrapper_object =head3 no_wrapper_object
By default RedMine API requires you to wrap you object data like this: By default RedMine API requires you to wrap you object data:
my $project = $redminer->createProject({ my $project = $redminer->createProject({
project => { project => {
...@@ -186,7 +186,8 @@ By default RedMine API requires you to wrap you object data like this: ...@@ -186,7 +186,8 @@ By default RedMine API requires you to wrap you object data like this:
# $project contains something like # $project contains something like
# { project => { id => 42, identifier => 'some-id', name => 'Some Name' ... } } # { project => { id => 42, identifier => 'some-id', name => 'Some Name' ... } }
By default this module follows this convention. However, if you specify something like By default this module follows this convention. However, if you turn on
the C<no_wrapper_object> flag
my $redminer = Redminer->new( my $redminer = Redminer->new(
host => 'example.com/redmine', host => 'example.com/redmine',
...@@ -194,7 +195,7 @@ By default this module follows this convention. However, if you specify somethin ...@@ -194,7 +195,7 @@ By default this module follows this convention. However, if you specify somethin
no_wrapper_object => 1, no_wrapper_object => 1,
); );
you can skip "wrapping" object data like this: you can skip "wrapping" object data, which results in simpler data structures:
my $project = $redminer->createProject({ my $project = $redminer->createProject({
identifier => 'some-id', identifier => 'some-id',
...@@ -203,6 +204,11 @@ you can skip "wrapping" object data like this: ...@@ -203,6 +204,11 @@ you can skip "wrapping" object data like this:
# $project contains something like # $project contains something like
# { id => 42, identifier => 'some-id', name => 'Some Name' ... } # { id => 42, identifier => 'some-id', name => 'Some Name' ... }
Please note that wrapping can be skipped only while operating on single objects,
i.e. this flag is honored for C<create*> and C<update*> requests as well as for
C<get>ting individual objects. This flag is ignored for C<delete*> calls and calls
like C<issues>.
=cut =cut
sub new sub new
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment