about summary refs log tree commit diff
path: root/t/lib/FakeAPI.pm
blob: 8fa64726ad37d54500368b8d28b3c89308286ef7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package FakeAPI;
use Moose;
use MooseX::Net::API;

net_api_declare demorest => (
    base_url       => 'http://localhost:3000/rest',
    format         => 'json',
    format_mode    => 'content-type',
    authentication => 0,
    username       => 'foo',
    password       => 'bar',
);

net_api_method users => (
    description => 'get a list of users',
    method      => 'GET',
    path        => '/users/',
    expected    => [qw/200/],
);

net_api_method get_user => (
    description => 'fetch information about a specific user',
    method      => 'GET',
    path        => '/user/$id',
    params      => [qw/id/],
    required    => [qw/id/],
    expected    => [qw/200 404/],
);

net_api_method create_user => (
    description => 'create a new user',
    method      => 'POST',
    path        => '/user/',
    params      => [qw/user nickname/],
    required    => [qw/user nickname/],
);

net_api_method update_user => (
    description => 'update information about a specific user',
    method      => 'PUT',
    path        => '/user/$id',
    params      => [qw/id nickname/],
    required    => [qw/id nickname/],
);

net_api_method delete_user => (
    description => 'terminate an user',
    method      => 'DELETE',
    path        => '/user/$id',
    params      => [qw/id/],
    required    => [qw/id/],
);

net_api_method auth_get_user => (
    description => 'fetch information about a specific user with authentication',
    method         => 'GET',
    path           => '/auth_user/$id',
    params         => [qw/id/],
    required       => [qw/id/],
    expected       => [qw/200 404/],
    authentication => 1,
);

1;