line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Pixela::User; |
2
|
6
|
|
|
6
|
|
228573
|
use 5.010001; |
|
6
|
|
|
|
|
27
|
|
3
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
153
|
|
4
|
6
|
|
|
6
|
|
35
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
177
|
|
5
|
6
|
|
|
6
|
|
40
|
use Carp qw/croak/; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
2124
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
43
|
|
|
43
|
0
|
8469
|
my ($class,$pixela_client) = @_; |
11
|
43
|
|
|
|
|
158
|
return bless +{ |
12
|
|
|
|
|
|
|
client => $pixela_client, |
13
|
|
|
|
|
|
|
}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub client { |
17
|
10
|
|
|
10
|
0
|
5955
|
my $self = shift; |
18
|
10
|
|
|
|
|
39
|
return $self->{client}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub create { |
22
|
2
|
|
|
2
|
1
|
2176
|
my ($self,%args) = @_; |
23
|
2
|
|
|
|
|
7
|
my $client = $self->client; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $params = { |
26
|
|
|
|
|
|
|
username => $client->username, |
27
|
|
|
|
|
|
|
token => $client->token, |
28
|
|
|
|
|
|
|
agreeTermsOfService => $args{agree_terms_of_service} || "yes", |
29
|
2
|
|
100
|
|
|
7
|
notMinor => $args{not_minor} || "yes", |
|
|
|
100
|
|
|
|
|
30
|
|
|
|
|
|
|
}; |
31
|
2
|
|
|
|
|
36
|
my $res = $client->request('POST','users/',$params); |
32
|
2
|
|
|
|
|
23
|
return $res; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub update { |
36
|
1
|
|
|
1
|
1
|
384
|
my ($self,$newtoken) = @_; |
37
|
1
|
|
|
|
|
4
|
my $client = $self->client; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
57
|
my $params = { |
40
|
|
|
|
|
|
|
newToken => $newtoken, |
41
|
|
|
|
|
|
|
}; |
42
|
1
|
|
|
|
|
7
|
my $res = $client->request_with_xuser_in_header('PUT',('users/'.$client->username),$params); |
43
|
1
|
|
|
|
|
14
|
$self->client->token($newtoken); |
44
|
1
|
|
|
|
|
12
|
return $res; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub delete { |
48
|
1
|
|
|
1
|
1
|
13
|
my $self = shift; |
49
|
1
|
|
|
|
|
4
|
my $client = $self->client; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
5
|
my $res = $client->request_with_xuser_in_header('DELETE',('users/'.$client->username),{}); |
52
|
1
|
|
|
|
|
14
|
return $res; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |