summaryrefslogtreecommitdiff
path: root/httemplate/REST/1.0/cust_pkg
blob: 3c58bcf319934fd51b022d4860d376b876043e5f (plain)
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
<% encode_rest($return) %>\
<%init>

rest_auth($cgi);

my( $pkgnum, $command ) = split('/', rest_uri_remain($r, $m), 2 );

if ( $r->method eq 'GET' ) {

  my $return = [];

  if ( $pkgnum ) {

    my $cust_pkg = qsearchs('cust_main', { 'pkgnum'=>$pkgnum } )
      or die "unknown pkgnum $pkgnum";

    if ( $command eq '' ) {

      $return = $cust_pkg->API_getinfo;

    } elsif ( $command eq 'cust_svc' ) {

      $return = [ map $_->API_getinfo, $cust_pkg->cust_svc ];

    }



  #} else { #list

  }

} elsif ( $r->method eq 'POST' ) { #create new

} elsif ( $r->method eq 'PUT' ) { #modify

}

</%init>