| 1 | 1 | ▶ | use v5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | package JMAP::Tester::WebSocket::Response 0.003; | ||
| 5 | # ABSTRACT: what you get in reply to a succesful JMAP request | ||
| 6 | |||
| 7 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | with 'JMAP::Tester::Role::SentenceCollection', 'JMAP::Tester::WebSocket::Role::WebSocketResult'; | |
| 9 | |||
| 10 | 1 | ▶ | use JMAP::Tester::Response::Sentence; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use JMAP::Tester::Response::Paragraph; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use JMAP::Tester::SentenceBroker; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | #pod =head1 OVERVIEW | ||
| 17 | #pod | ||
| 18 | #pod A JMAP::Tester::WebSocket::Response object represents the successful response to a JMAP | ||
| 19 | #pod call. It is a successful L<JMAP::Tester::Result>. | ||
| 20 | #pod | ||
| 21 | #pod A Response is used mostly to contain the responses to the individual methods | ||
| 22 | #pod passed in the request. | ||
| 23 | #pod | ||
| 24 | #pod =cut | ||
| 25 | |||
| 26 | 0 | ▶ | sub is_success { 1 } |
|
Subroutine
is_success: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 27 | |||
| 28 | 1 | has items => ( | |
| 29 | is => 'bare', | ||
| 30 | reader => '_items', | ||
| 31 | required => 1, | ||
| 32 | ); | ||
| 33 | |||
| 34 | 1 | has wrapper_properties => ( | |
| 35 | is => 'ro', | ||
| 36 | ); | ||
| 37 | |||
| 38 | 0 | ▶ | sub items { @{ $_[0]->_items } } |
|
Subroutine
items: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 39 | |||
| 40 | sub add_items { | ||
| 41 | $_[0]->sentence_broker->abort("can't add items to " . __PACKAGE__); | ||
| 42 | } | ||
| 43 | |||
| 44 | sub default_diagnostic_dumper { | ||
| 45 | 0 | ▶ | state $default = do { |
|
Subroutine
default_diagnostic_dumper: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 46 | 0 | require JSON::MaybeXS; | |
| 47 | 0 | state $json = JSON::MaybeXS->new->utf8->convert_blessed->pretty->canonical; | |
| 48 | 0 | ▶ | sub { $json->encode($_[0]); } |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 49 | 0 | }; | |
| 50 | |||
| 51 | 0 | return $default; | |
| 52 | } | ||
| 53 | |||
| 54 | 1 | has _diagnostic_dumper => ( | |
| 55 | is => 'ro', | ||
| 56 | builder => 'default_diagnostic_dumper', | ||
| 57 | init_arg => 'diagnostic_dumper', | ||
| 58 | ); | ||
| 59 | |||
| 60 | sub dump_diagnostic { | ||
| 61 | 0 | ▶ | my ($self, $value) = @_; |
|
Subroutine
dump_diagnostic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 62 | 0 | $self->_diagnostic_dumper->($value); | |
| 63 | } | ||
| 64 | |||
| 65 | sub sentence_broker; | ||
| 66 | has sentence_broker => ( | ||
| 67 | is => 'ro', | ||
| 68 | lazy => 1, | ||
| 69 | init_arg => undef, | ||
| 70 | default => sub { | ||
| 71 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 72 | 0 | JMAP::Tester::SentenceBroker->new({ response => $self }); | |
| 73 | }, | ||
| 74 | 1 | ); | |
| 75 | |||
| 76 | 1 | 1; | |
| 77 | |||
| 78 | __END__ | ||