Footprintless-Plugin-Atlassian-Confluence

 view release on metacpan or  search on metacpan

docs/Footprintless-Plugin-Atlassian-Confluence-ResponseParser.html  view on Meta::CPAN

name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>This is the default implementation of a response parser. There is a parse method for corresponding to each build method in <a href="http://search.cpan.org/perldoc?Footprintless%3A%3APlugin%3A%3AAtlassian%3A%3AConfluence%3A%3ARequestBuilder" class=...
>Footprintless::Plugin::Atlassian::Confluence::RequestBuilder</a>, and they all parse http responses into a hasref of the form:</p>

<pre>   my $response = {
       status =&#62; 0, # truthy if $http_response-&#62;is_success()
       code =&#62; 200, # $http_response-&#62;code()
       message =&#62; &#39;Success&#39;, # $http_response-&#62;message()
       content =&#62; {} # decode_json($http_response-&#62;decoded_content())
   };</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="CONSTRUCTORS"
>CONSTRUCTORS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="new()"
>new()</a></h2>

lib/Footprintless/Plugin/Atlassian/Confluence/ResponseParser.pm  view on Meta::CPAN

}

sub _parse_response {
    my ( $self, $http_response ) = @_;

    my %response = (
        code    => $http_response->code(),
        message => $http_response->message(),
    );

    my $content = $http_response->decoded_content();
    if ( $http_response->is_success() ) {
        $response{success} = 1;
        $response{content} = $content ? decode_json($content) : '';
    }
    else {
        $response{success} = 0;
        $response{content} = $http_response->decoded_content();
    }

    return \%response;
}

sub update_content {
    my ( $self, $http_response ) = @_;
    return $self->_parse_response($http_response);
}

lib/Footprintless/Plugin/Atlassian/Confluence/ResponseParser.pm  view on Meta::CPAN


This is the default implementation of a response parser.  There is a parse 
method for corresponding to each build method in 
L<Footprintless::Plugin::Atlassian::Confluence::RequestBuilder>, and they
all parse http responses into a hasref of the form:

   my $response = {
       status => 0, # truthy if $http_response->is_success()
       code => 200, # $http_response->code()
       message => 'Success', # $http_response->message()
       content => {} # decode_json($http_response->decoded_content())
   };

=head1 CONSTRUCTORS

=head2 new()

Constructs a new response parser.

=head1 AUTHOR



( run in 0.230 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )