| 1 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package Footprintless::Plugin::Atlassian::Confluence::ResponseParser; | ||||||||||
| 5 | 2 | $Footprintless::Plugin::Atlassian::Confluence::ResponseParser::VERSION = '1.03'; | |||||||||
| 6 | # ABSTRACT: A response parser for the Atlassian Confluence REST API | ||||||||||
| 7 | # PODNAME: Footprintless::Plugin::Atlassian::Confluence::ResponseParser | ||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 12 | 3 | return bless( {}, shift )->_init(@_); | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub create_content { | ||||||||
|
Subroutine
create_content: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | 0 | my ( $self, $http_response ) = @_; | |||||||||
| 17 | 0 | return $self->_parse_response($http_response); | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub delete_content { | ||||||||
|
Subroutine
delete_content: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my ( $self, $http_response ) = @_; | |||||||||
| 22 | 0 | return $self->_parse_response($http_response); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 4 | ▶ | sub get_content { | ||||||||
|
Subroutine
get_content: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | 4 | my ( $self, $http_response ) = @_; | |||||||||
| 27 | 4 | return $self->_parse_response($http_response); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub get_content_children { | ||||||||
|
Subroutine
get_content_children: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | 0 | my ( $self, $http_response ) = @_; | |||||||||
| 32 | 0 | return $self->_parse_response($http_response); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 3 | ▶ | sub _init { | ||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 3 | my ($self) = @_; | |||||||||
| 37 | 3 | return $self; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 4 | ▶ | sub _parse_response { | ||||||||
|
Subroutine
_parse_response: called CC=3 SCAR=11.0
| |||||||||||
| 41 | 4 | my ( $self, $http_response ) = @_; | |||||||||
| 42 | |||||||||||
| 43 | 4 | my %response = ( | |||||||||
| 44 | code => $http_response->code(), | ||||||||||
| 45 | message => $http_response->message(), | ||||||||||
| 46 | ); | ||||||||||
| 47 | |||||||||||
| 48 | 4 | my $content = $http_response->decoded_content(); | |||||||||
| 49 | 4 | ▶ | if ( $http_response->is_success() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 3 | $response{success} = 1; | |||||||||
| 51 | 3 | ▶ | $response{content} = $content ? decode_json($content) : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | } | ||||||||||
| 53 | else { | ||||||||||
| 54 | 1 | $response{success} = 0; | |||||||||
| 55 | 1 | $response{content} = $http_response->decoded_content(); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 4 | return \%response; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub update_content { | ||||||||
|
Subroutine
update_content: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 0 | my ( $self, $http_response ) = @_; | |||||||||
| 63 | 0 | return $self->_parse_response($http_response); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 2 | 1; | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||