aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock/Twilio.pm
blob: b351667041ea463378bfc11b9b28762cab86a0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package t::Mock::Twilio;

use Web::Simple;

has texts => (
    is => 'ro',
    default => sub { [] },
);

sub dispatch_request {
    my $self = shift;

    sub (POST + /2010-04-01/Accounts/*/Messages.json + %*) {
        my ($self, $sid, $data) = @_;
        push @{$self->texts}, $data;
        return [ 200, [ 'Content-Type' => 'application/json' ], [ '{}' ] ];
    },
}

__PACKAGE__->run_if_script;