[Bps-public-commit] r18286 - in Net-Google-Code/branches/write: .
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Feb 9 01:49:08 EST 2009
Author: sunnavy
Date: Mon Feb 9 01:49:08 2009
New Revision: 18286
Modified:
Net-Google-Code/branches/write/ (props changed)
Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm
Log:
r19695 at sunnavys-mb: sunnavy | 2009-02-09 14:44:56 +0800
added update method
Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm (original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm Mon Feb 9 01:49:08 2009
@@ -139,6 +139,50 @@
}
+sub update {
+ my $self = shift;
+ my %args = validate(
+ @_,
+ {
+ label => { type => HASHREF | ARRAYREF, optional => 1 },
+ map { $_ => { type => SCALAR, optional => 1 } }
+ qw/comment summary status owner merge_into cc blocked_on/,
+ }
+ );
+
+ $self->signin;
+ $self->fetch( 'issues/detail?id=' . $self->id );
+ $self->mech->form_with_fields( 'comment', 'summary' );
+
+ # convert hash to array. e.g. Type => Defect to Type-Defect
+ if ( $args{label} && ref $args{label} eq 'HASH' ) {
+ $args{label} =
+ [ map { $_ . '-' . $args{label}{$_} } keys %{ $args{label} } ];
+ }
+
+ $self->mech->submit_form(
+ fields => {
+ map { $_ => $args{$_} }
+ grep { exists $args{$_} }
+ qw/comment summary status owner merge_into cc label
+ blocked_on/
+ }
+ );
+
+ require HTML::TreeBuilder;
+ my $tree = HTML::TreeBuilder->new;
+ $tree->parse_content( $self->mech->content );
+ $tree->elementify;
+
+ my ($notice) = $tree->look_down( class => 'notice' );
+ if ( $notice && $notice->as_text =~ /has been updated/ ) {
+ return 1;
+ }
+
+ return;
+}
+
+
no Moose;
__PACKAGE__->meta->make_immutable;
@@ -181,6 +225,9 @@
=head2 description
+=head2 update
+comment, summary, status, owner, merge_into, cc, label, blocked_on
+
=head1 AUTHOR
sunnavy C<< <sunnavy at bestpractical.com> >>
More information about the Bps-public-commit
mailing list