NAME
JMAP::Tester::Response - what you get in reply to a succesful JMAP request
VERSION
version 0.011
OVERVIEW
A JMAP::Tester::Response object represents the successful response to a JMAP call. It is a successful JMAP::Tester::Result.
A Response is used mostly to contain the responses to the individual methods passed in the request.
METHODS
sentence
my $sentence = $response->sentence($n);
This method returns the nth Sentence of the response.
sentences
my @sentences = $response->sentences;
This method returns a list of all sentences in the response.
single_sentence
my $sentence = $response->single_sentence;
my $sentence = $response->single_sentence($name);
This method returns the only Sentence of the response, raising an exception if there's more than one Sentence. If $name
is given, an exception is raised if the Sentence's name doesn't match the given name.
sentence_named
my $sentence = $response->sentence_named($name);
This method returns the sentence with the given name. If no such sentence exists, or if two sentences with the name exist, the tester will abort.
assert_n_sentences
my ($s1, $s2, ...) = $response->assert_n_sentences($n);
This method returns all the sentences in the response, as long as there are exactly $n
. Otherwise, it aborts.
paragraph
my $para = $response->paragraph($n);
This method returns the nth Paragraph of the response.
paragraphs
my @paragraphs = $response->paragraphs;
This method returns a list of all paragraphs in the response.
assert_n_paragraphs
my ($p1, $p2, ...) = $response->assert_n_paragraphs($n);
This method returns all the paragraphs in the response, as long as there are exactly $n
. Otherwise, it aborts.
paragraph_by_client_id
my $para = $response->paragraph_by_client_id($cid);
This returns the paragraph for the given client id. If there is no paragraph for that client id, an empty list is returned.
as_struct
as_stripped_struct
This method returns an arrayref of arrayrefs, holding the data returned by the JMAP server. With as_struct
, some of the JSON data may be in objects provided by JSON::Typist. If you'd prefer raw data, use the as_stripped_struct
form.
as_pairs
as_stripped_pairs
These methods do the same thing as as_struct
and <as_stripped_struct>, but omit client ids.
AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by FastMail, Ltd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.