API/Matterbridge.pm

filter: Statementstmt 75.0% 30 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 43.7% 7 / 16 Podpod 0.0% 0 / 3 totaltotal 62.7% 37 / 59 CC 1 SCAR 4.5
CC
1
Cov
75%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.6
« Mojolicious/Matterbridge.pm ↑ Summary API/Matterbridge/Message.pm »
1 package API::Matterbridge;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moo::Role 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Filter::signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 requires 'build_request', 'short_ua', 'stream_ua';
13  
14 1 our $VERSION = '0.02';
15  
16 =head1 SEE ALSO
17  
18 L<https://app.swaggerhub.com/apis-docs/matterbridge/matterbridge-api/0.1.0-oas3>
19  
20 =cut
21  
22 # Naah, this should move straight to Mojolicious
23 # instead of separating out a protocol module that can be used elsewhere ...
24 # The message stream (via /api/stream) needs special async handling and can't
25 # be used with (for example) LWP
26  
27 has 'url' => (
28 is => 'lazy',
29 0 ▶ default => sub { URI->new( 'http://localhost:4242/api/' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 1 );
31  
32 has 'health_url' => (
33 is => 'lazy',
34 0 ▶ default => sub { URI->new( $_[0]->url . 'health' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 1 );
36  
37 has 'message_url' => (
38 is => 'lazy',
39 0 ▶ default => sub { URI->new( $_[0]->url . 'message' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
40 1 );
41  
42 has 'messages_url' => (
43 is => 'lazy',
44 0 ▶ default => sub { URI->new( $_[0]->url . 'messages' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 1 );
46  
47 has 'stream_url' => (
48 is => 'lazy',
49 0 ▶ default => sub { URI->new( $_[0]->url . 'stream' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
50 1 );
51  
52 has 'json' => (
53 is => 'lazy',
54 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
55 0 require JSON;
56 0 return JSON->new()
57 },
58 1 );
59  
60 0 ▶sub build_post_message( $self, %options ) {
Subroutine build_post_message: not called CC=1 SCAR=6.9
Pod undocumented
61 0 $self->build_request(
62 method => 'POST',
63 url => $self->message_url,
64 headers => {
65 'Content-Type' => 'application/json',
66 },
67 data => $self->json->encode( \%options ),
68 ua => $self->short_ua,
69 );
70 }
71  
72 0 ▶sub build_get_messages( $self ) {
Subroutine build_get_messages: not called CC=1 SCAR=6.9
Pod undocumented
73 0 $self->build_request(
74 method => 'GET',
75 url => $self->messages_url,
76 ua => $self->short_ua,
77 );
78 }
79  
80 0 ▶sub build_get_message_stream( $self ) {
Subroutine build_get_message_stream: not called CC=1 SCAR=6.9
Pod undocumented
81 0 $self->build_request(
82 method => 'GET',
83 url => $self->stream_url,
84 ua => $self->stream_ua,
85 );
86 }
87  
88 1 1;
89  
90 =head1 REPOSITORY
91  
92 The public repository of this module is
93 L<https://github.com/Corion/Mojolicious-Matterbridge>.
94  
95 =head1 SUPPORT
96  
97 The public support forum of this module is L<https://perlmonks.org/>.
98  
99 =head1 BUG TRACKER
100  
101 Please report bugs in this module via the Github bug queue at
102 L<https://github.com/Corion/Mojolicious-Matterbridge/issues>
103  
104 =head1 AUTHOR
105  
106 Max Maischein C<corion@cpan.org>
107  
108 =head1 COPYRIGHT (c)
109  
110 Copyright 2020 by Max Maischein C<corion@cpan.org>.
111  
112 =head1 LICENSE
113  
114 This module is released under the same terms as Perl itself.
115  
116 =cut
« Mojolicious/Matterbridge.pm ↑ Summary API/Matterbridge/Message.pm »