line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
10
|
use Moops -strict; |
|
4
|
|
|
|
|
505
|
|
|
4
|
|
|
|
|
304
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: represents a user |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=pod |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WebService::Intercom::User - represent a user. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $user = $intercom->user_create_or_update( |
14
|
|
|
|
|
|
|
email => 'test@example.com', |
15
|
|
|
|
|
|
|
name => 'test user'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Retrieve an existing user. |
18
|
|
|
|
|
|
|
my $existing_user = $intercom->user_get(email => 'test2@example.com'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Add a tag to a user |
21
|
|
|
|
|
|
|
$user->tag('test tag'); |
22
|
|
|
|
|
|
|
$user->untag('test tag'); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Change the user's name or any other value |
25
|
|
|
|
|
|
|
$user->name = 'new name'; |
26
|
|
|
|
|
|
|
$user->email = 'new-email@example.com'; |
27
|
|
|
|
|
|
|
$user->save(); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Delete the user |
30
|
|
|
|
|
|
|
$user->delete(); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Add a note |
33
|
|
|
|
|
|
|
$user->add_note(body => "This is a test note"); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Add an event |
36
|
|
|
|
|
|
|
$user->add_event(event_name => 'test event'); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Provides an object that represents a user at Intercom. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Attributes are defined at L<http://doc.intercom.io/api/#users> |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item type |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item id |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item created_at |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item signed_up_at |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item updated_at |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item user_id |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item email |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item name |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item custom_attributes |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item last_request_at |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item session_count |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item avatar |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item unsubscribed_from_emails |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item location_data |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item user_agent_data |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item last_seen_ip |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item companies |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item social_profiles |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item segments |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item tags |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item intercom - the WebService::Intercom object that created this user object |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 METHODS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item save() - save any changes made to this object back to |
97
|
|
|
|
|
|
|
Intercom.io, returns a new WebService::Intercom::User object with the |
98
|
|
|
|
|
|
|
updated user. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item delete() - delete this user at Intercom.io |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item tag(name => $tag_name) - Add a tag to this user |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item tag(WebService::Intercom::Tag) - Add a tag to this user |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item untag(name => $tag_name) - Remove a tag from this user |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item add_note(admin_id => $admin_id, body => $message) - Add a note to this user |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item add_event(event_name => $event_name, created_at => time, metadata => {}) - Add an event to this user. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
4
|
|
|
2
|
|
7634
|
class WebService::Intercom::User types WebService::Intercom::Types { |
|
4
|
|
|
2
|
|
431
|
|
|
4
|
|
|
2
|
|
300
|
|
|
4
|
|
|
|
|
293
|
|
|
2
|
|
|
|
|
147
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
711
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
143
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
121
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
203
|
|
|
2
|
|
|
|
|
72
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
14985
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
1022
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
296
|
|
|
2
|
|
|
|
|
64
|
|
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
179
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
29
|
|
|
2
|
|
|
|
|
485
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
2138
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
7200
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
104
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
126
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
43
|
|
|
2
|
|
|
|
|
333
|
|
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
8215
|
|
117
|
2
|
|
|
|
|
30
|
has 'type' => (is => 'ro'); |
118
|
2
|
|
|
|
|
1577
|
has 'id' => (is => 'ro'); |
119
|
2
|
|
|
|
|
689
|
has 'created_at' => (is => 'rw', isa => Int); |
120
|
2
|
|
|
|
|
1297
|
has 'signed_up_at' => (is => 'rw', isa => Int); |
121
|
2
|
|
|
|
|
963
|
has 'updated_at' => (is => 'rw', isa => Int); |
122
|
2
|
|
|
|
|
957
|
has 'user_id' => (is => 'rw', isa => Str); |
123
|
2
|
|
|
|
|
930
|
has 'email' => (is => 'rw', isa => Str); |
124
|
2
|
|
|
|
|
883
|
has 'name' => (is => 'rw', isa => Str); |
125
|
2
|
|
|
|
|
969
|
has 'custom_attributes' => (is => 'rw', isa => CustomAttributesType); |
126
|
2
|
|
|
|
|
1405
|
has 'last_request_at' => (is => 'rw', isa => Int); |
127
|
2
|
|
|
|
|
1093
|
has 'session_count' => (is => 'ro', isa => Int); |
128
|
2
|
|
|
|
|
837
|
has 'avatar' => (is => 'ro', isa => AvatarType); |
129
|
2
|
|
|
|
|
2372
|
has 'unsubscribed_from_emails' => (is => 'rw', isa => Bool); |
130
|
2
|
|
|
|
|
1046
|
has 'location_data' => (is => 'ro', isa => LocationDataType); |
131
|
2
|
|
|
|
|
7058
|
has 'user_agent_data' => (is => 'ro', isa => Str); |
132
|
2
|
|
|
|
|
850
|
has 'last_seen_ip' => (is => 'ro', isa => IPAddressType); |
133
|
2
|
|
|
|
|
1038
|
has 'companies' => (is => 'ro', isa => CompaniesListType); |
134
|
2
|
|
|
|
|
2592
|
has 'social_profiles' => (is => 'ro', isa => SocialProfileListType); |
135
|
2
|
|
|
|
|
2540
|
has 'segments' => (is => 'ro', isa => SegmentsListType); |
136
|
2
|
|
|
|
|
2482
|
has 'tags' => (is => 'ro', isa => TagsListType); |
137
|
|
|
|
|
|
|
|
138
|
2
|
|
|
|
|
2457
|
has 'intercom' => (is => 'ro', isa => InstanceOf["WebService::Intercom"], required => 1); |
139
|
|
|
|
|
|
|
|
140
|
2
|
0
|
|
2
|
|
4584
|
method save() { |
|
2
|
0
|
|
0
|
|
4
|
|
|
2
|
|
|
|
|
283
|
|
|
2
|
|
|
|
|
1967
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
$self->intercom->user_create_or_update($self); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
2
|
0
|
|
2
|
|
2298
|
method delete() { |
|
2
|
0
|
|
0
|
|
4
|
|
|
2
|
|
|
|
|
226
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
$self->intercom->user_delete($self); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
2
|
0
|
0
|
2
|
|
18577
|
multi method tag(Str :$name) { |
|
2
|
0
|
0
|
2
|
|
9
|
|
|
2
|
0
|
|
2
|
|
397
|
|
|
2
|
0
|
|
0
|
|
12
|
|
|
2
|
0
|
|
|
|
4
|
|
|
2
|
0
|
|
|
|
590
|
|
|
2
|
0
|
|
|
|
14
|
|
|
2
|
0
|
|
|
|
2
|
|
|
2
|
|
|
|
|
326
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
$self->intercom->tag_items(name => $name, |
150
|
|
|
|
|
|
|
users => [{ |
151
|
|
|
|
|
|
|
id => $self->id, |
152
|
|
|
|
|
|
|
email => $self->email, |
153
|
|
|
|
|
|
|
user_id => $self->user_id, |
154
|
|
|
|
|
|
|
}]); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
2
|
0
|
|
2
|
|
10656
|
multi method tag(WebService::Intercom::Tag $tag) { |
|
2
|
0
|
|
2
|
|
4
|
|
|
2
|
0
|
|
0
|
|
413
|
|
|
2
|
0
|
|
|
|
8
|
|
|
2
|
0
|
|
|
|
4
|
|
|
2
|
0
|
|
|
|
203
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
$self->intercom->tag_items(name => $tag->name, |
159
|
|
|
|
|
|
|
users => [{ |
160
|
|
|
|
|
|
|
id => $self->id, |
161
|
|
|
|
|
|
|
email => $self->email, |
162
|
|
|
|
|
|
|
user_id => $self->user_id, |
163
|
|
|
|
|
|
|
}]); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
2
|
0
|
0
|
2
|
|
4827
|
method untag(Str :$name) { |
|
2
|
0
|
0
|
2
|
|
4
|
|
|
2
|
0
|
|
2
|
|
192
|
|
|
2
|
0
|
|
0
|
|
9
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
|
|
|
|
465
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
192
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
$self->intercom->tag_items(name => $name, |
170
|
|
|
|
|
|
|
users => [{ |
171
|
|
|
|
|
|
|
id => $self->id, |
172
|
|
|
|
|
|
|
email => $self->email, |
173
|
|
|
|
|
|
|
user_id => $self->user_id, |
174
|
|
|
|
|
|
|
untag => 1 |
175
|
|
|
|
|
|
|
}]); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
method add_note(Str :$admin_id?, |
179
|
2
|
0
|
0
|
2
|
|
6224
|
Str :$body?) { |
|
2
|
0
|
0
|
2
|
|
5
|
|
|
2
|
0
|
|
2
|
|
204
|
|
|
2
|
0
|
|
2
|
|
8
|
|
|
2
|
0
|
|
0
|
|
2
|
|
|
2
|
0
|
|
|
|
423
|
|
|
2
|
0
|
|
|
|
9
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
|
|
|
|
195
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
207
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
$self->intercom->note_create(id => $self->id, |
181
|
|
|
|
|
|
|
email => $self->email, |
182
|
|
|
|
|
|
|
user_id => $self->user_id, |
183
|
|
|
|
|
|
|
admin_id => $admin_id, |
184
|
|
|
|
|
|
|
body => $body); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
method add_event(EventNameType :$event_name, |
188
|
|
|
|
|
|
|
Maybe[Int] :$created_at?, |
189
|
2
|
0
|
0
|
2
|
|
11622
|
EventMetadataType :$metadata? where { scalar(keys %$_) <= 5 }) { |
|
2
|
0
|
0
|
2
|
|
6
|
|
|
2
|
0
|
0
|
2
|
|
275
|
|
|
2
|
0
|
0
|
2
|
|
12
|
|
|
2
|
0
|
0
|
2
|
|
3
|
|
|
2
|
0
|
0
|
0
|
|
681
|
|
|
2
|
0
|
0
|
|
|
13
|
|
|
2
|
0
|
0
|
|
|
4
|
|
|
2
|
0
|
0
|
|
|
364
|
|
|
2
|
0
|
0
|
|
|
12
|
|
|
2
|
0
|
0
|
|
|
3
|
|
|
2
|
0
|
0
|
|
|
325
|
|
|
2
|
0
|
0
|
|
|
11
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
0
|
|
|
|
1766
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$self->intercom->event_create(user_id => $self->user_id, |
191
|
|
|
|
|
|
|
email => $self->email, |
192
|
|
|
|
|
|
|
event_name => $event_name, |
193
|
|
|
|
|
|
|
created_at => $created_at, |
194
|
|
|
|
|
|
|
metadata => $metadata); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
}; |
197
|
|
|
|
|
|
|
1; |