NAME

JMAP::Tester::Response::Paragraph - a group of sentences in a JMAP response

VERSION

version 0.007

OVERVIEW

These objects represent paragraphs in the JMAP response. That is, if your response is:

[
  [ "messages", { ... }, "a" ],      # 1
  [ "smellUpdates", { ... }, "b" ],  # 2
  [ "smells",       { ... }, "b" ],  # 3
]

...then #1 forms one paragraph and #2 and #3 together form another. It goes by matching client ids.

METHODS

sentences

The sentences method returns a list of Sentence objects, one for each sentence in the paragraph.

sentence

my $sentence = $para->sentence($n);

This method returns the nth sentence of the paragraph.

single

my $sentence = $para->single;
my $sentence = $para->single($name);

This method throws an exception if there is more than one sentence in the paragraph. If a $name argument is given and the paragraph's single sentence doesn't have that name, an exception is raised.

Otherwise, this method returns the sentence.

as_struct

as_stripped_struct

as_struct returns an arrayref containing the result of calling as_struct on each sentence in the paragraph. as_stripped_struct removes JSON types.

as_pairs

as_pairs returns an arrayref containing the result of calling as_pair on each sentence in the paragraph. as_stripped_pairs removes JSON types.

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.