| 1 | 2 | ▶ | use v5.20.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package JMAP::Tester::Response 0.113; | ||
| 4 | # ABSTRACT: what you get in reply to a succesful JMAP request | ||
| 5 | |||
| 6 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use experimental 'signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | # We can't use 'sub sentencebroker;' as a stub here as it conflicts | ||
| 10 | # with older Role::Tiny versions (2.000006, 2.000008, and others). | ||
| 11 | # With the stub, we'd see this error during compilation: | ||
| 12 | # | ||
| 13 | # Can't use string ("-1") as a symbol ref while "strict refs" in use at | ||
| 14 | # /usr/share/perl5/Role/Tiny.pm line 382 | ||
| 15 | # | ||
| 16 | # We could pin a newer Role::Tiny version but this fix is easy enough | ||
| 17 | |||
| 18 | has sentence_broker => ( | ||
| 19 | is => 'ro', | ||
| 20 | lazy => 1, | ||
| 21 | init_arg => undef, | ||
| 22 | 29 | ▶ | default => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 23 | 29 | my ($self) = @_; | |
| 24 | 29 | JMAP::Tester::SentenceBroker->new({ response => $self }); | |
| 25 | }, | ||
| 26 | 2 | ); | |
| 27 | |||
| 28 | 2 | with 'JMAP::Tester::Role::SentenceCollection', 'JMAP::Tester::Role::HTTPResult'; | |
| 29 | |||
| 30 | 2 | ▶ | use JMAP::Tester::Response::Sentence; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 2 | ▶ | use JMAP::Tester::Response::Paragraph; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | 2 | ▶ | use JMAP::Tester::SentenceBroker; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | |||
| 34 | 2 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | #pod =head1 OVERVIEW | ||
| 37 | #pod | ||
| 38 | #pod A JMAP::Tester::Response object represents the successful response to a JMAP | ||
| 39 | #pod request -- the kind where you've POSTed a JSON object with C<methodCalls>. It | ||
| 40 | #pod is a successful L<JMAP::Tester::Role::Result>. | ||
| 41 | #pod | ||
| 42 | #pod A Response is used mostly to contain the responses to the individual methods | ||
| 43 | #pod passed in the request. For all of that interface, consult | ||
| 44 | #pod L<JMAP::Tester::Role::SentenceCollection>. | ||
| 45 | #pod | ||
| 46 | #pod A Response is also a L<JMAP::Tester::Role::HTTPResult>, meaning it has a | ||
| 47 | #pod C<http_response> method that returns an L<HTTP::Response> object. | ||
| 48 | #pod | ||
| 49 | #pod =cut | ||
| 50 | |||
| 51 | 5 | ▶ | sub is_success { 1 } |
|
Subroutine
is_success: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 52 | |||
| 53 | 2 | has items => ( | |
| 54 | is => 'bare', | ||
| 55 | reader => '_items', | ||
| 56 | required => 1, | ||
| 57 | ); | ||
| 58 | |||
| 59 | 2 | has wrapper_properties => ( | |
| 60 | is => 'ro', | ||
| 61 | ); | ||
| 62 | |||
| 63 | 111 | ▶ | sub items ($self) { @{ $self->_items } } |
|
Subroutine
items: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 64 | |||
| 65 | 1 | ▶ | sub add_items ($self, @) { |
|
Subroutine
add_items: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 66 | 1 | $self->abort("can't add items to " . __PACKAGE__); | |
| 67 | } | ||
| 68 | |||
| 69 | 13 | ▶ | sub default_diagnostics ($self) { |
|
Subroutine
default_diagnostics: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 70 | 13 | return [ 'Response sentences', [ $self->sentences ] ]; | |
| 71 | } | ||
| 72 | |||
| 73 | 2 | 1; | |
| 74 | |||
| 75 | __END__ | ||