line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Freshservice::Agent; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16
|
use v5.010; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
58
|
|
6
|
1
|
|
|
1
|
|
8
|
use Method::Signatures 20140224; |
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
9
|
|
7
|
1
|
|
|
1
|
|
542
|
use Carp qw( croak ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
8
|
1
|
|
|
1
|
|
14
|
use WebService::Freshservice::User::CustomField; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
9
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
10
|
1
|
|
|
1
|
|
398
|
use MooX::HandlesVia; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
11
|
1
|
|
|
1
|
|
141
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Freshservice User |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION: Generated by DZP::OurPkg:Version |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'WebService::Freshservice::User'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Fixed fields |
21
|
|
|
|
|
|
|
has 'active_since' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
22
|
|
|
|
|
|
|
has 'available' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
23
|
|
|
|
|
|
|
has 'created_at' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
24
|
|
|
|
|
|
|
has 'occasional' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
25
|
|
|
|
|
|
|
has 'signature' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
26
|
|
|
|
|
|
|
has 'signature_html' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
27
|
|
|
|
|
|
|
has 'points' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
28
|
|
|
|
|
|
|
has 'scoreboard_level_id' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
29
|
|
|
|
|
|
|
has 'ticket_permission' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
30
|
|
|
|
|
|
|
has 'updated_at' => ( is => 'ro', lazy => 1, builder => '_build_agent' ); |
31
|
|
|
|
|
|
|
has 'user_id' => ( is => 'ro', lazy => 1, builder => '_build_user_override' ); |
32
|
|
|
|
|
|
|
has 'user_created_at' => ( is => 'ro', lazy => 1, builder => '_build_user_override' ); |
33
|
|
|
|
|
|
|
has 'user_updated_at' => ( is => 'ro', lazy => 1, builder => '_build_user_override' ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Updateable Fields |
36
|
|
|
|
|
|
|
|
37
|
1
|
0
|
|
1
|
|
1399
|
method _build__raw { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self->api->get_api( "agents/".$self->id.".json" ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
0
|
|
1
|
|
860
|
method _build_user { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Grab our calling method by dropping 'WebService::Freshservice::User::' |
43
|
0
|
|
|
|
|
|
my $caller = substr((caller 1)[3],32); |
44
|
0
|
|
|
|
|
|
return $self->_raw->{agent}{user}{$caller}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
0
|
|
1
|
|
882
|
method _build_user_override { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Grab our calling method by dropping 'WebService::Freshservice::Agent::' |
49
|
0
|
|
|
|
|
|
my $caller = substr((caller 1)[3],38); |
50
|
0
|
|
|
|
|
|
return $self->_raw->{agent}{user}{$caller}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
1
|
0
|
|
1
|
|
835
|
method _build_agent { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Grab our calling method by dropping 'WebService::Freshservice::Agent::' |
55
|
0
|
|
|
|
|
|
my $caller = substr((caller 1)[3],33); |
56
|
0
|
|
|
|
|
|
return $self->_raw->{agent}{$caller}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
0
|
|
1
|
|
840
|
method _build_custom_field { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $fields = { }; |
61
|
0
|
|
|
|
|
|
while ( my ( $key, $value ) = each %{ $self->_raw->{agent}{user}{custom_field} } ) { |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$fields->{$key} = WebService::Freshservice::User::CustomField->new( |
63
|
|
|
|
|
|
|
id => $self->id, |
64
|
|
|
|
|
|
|
api => $self->api, |
65
|
|
|
|
|
|
|
field => $key, |
66
|
|
|
|
|
|
|
value => $value, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
return $fields; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
1
|
0
|
|
1
|
|
3316
|
method get_custom_field($field) { |
|
0
|
0
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
croak "Custom field must exist in freshservice" |
74
|
0
|
0
|
|
|
|
|
unless exists $self->_raw->{agent}{user}{custom_field}{$field}; |
75
|
0
|
|
|
|
|
|
return $self->_get_cf($field); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
1
|
0
|
|
1
|
|
1019
|
method delete_requester { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
croak("This method is not available to Agents"); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
1
|
0
|
|
1
|
|
868
|
method update_requester { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
croak("This method is not available to Agents"); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
1
|
0
|
|
1
|
|
817
|
method set_custom_field { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
croak("This method is not available to Agents"); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=pod |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=encoding UTF-8 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
WebService::Freshservice::Agent - Freshservice User |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
version 0.004 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SYNOPSIS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
use WebService::Freshservice::Agent; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $request = WebService::Freshservice::Agent->new( api => $api, id => '1234567890' ); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Requires an 'WebService::Freshservice::API' object and agent id. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DESCRIPTION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Provides a Freshservice agent object. Agents are read-only, all update methods |
117
|
|
|
|
|
|
|
will result in a croak. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Leon Wright <techman@cpan.org> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Leon Wright. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |