line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
9
|
use Moops -strict; |
|
4
|
|
|
|
|
424
|
|
|
4
|
|
|
|
|
237
|
|
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
|
|
5834
|
class WebService::Intercom::User types WebService::Intercom::Types { |
|
4
|
|
|
2
|
|
371
|
|
|
4
|
|
|
2
|
|
253
|
|
|
4
|
|
|
|
|
235
|
|
|
2
|
|
|
|
|
118
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
493
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
106
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
151
|
|
|
2
|
|
|
|
|
50
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
11245
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
810
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
237
|
|
|
2
|
|
|
|
|
42
|
|
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
133
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
381
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
1613
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
5811
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
87
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
55
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
96
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
39
|
|
|
2
|
|
|
|
|
258
|
|
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
6466
|
|
117
|
2
|
|
|
|
|
25
|
has 'type' => (is => 'ro'); |
118
|
2
|
|
|
|
|
1403
|
has 'id' => (is => 'ro'); |
119
|
2
|
|
|
|
|
590
|
has 'created_at' => (is => 'rw', isa => Maybe[Int]); |
120
|
2
|
|
|
|
|
1680
|
has 'signed_up_at' => (is => 'rw', isa => Maybe[Int]); |
121
|
2
|
|
|
|
|
931
|
has 'updated_at' => (is => 'rw', isa => Maybe[Int]); |
122
|
2
|
|
|
|
|
932
|
has 'user_id' => (is => 'rw', isa => Maybe[Str]); |
123
|
2
|
|
|
|
|
1111
|
has 'email' => (is => 'rw', isa => Maybe[Str]); |
124
|
2
|
|
|
|
|
935
|
has 'name' => (is => 'rw', isa => Maybe[Str]); |
125
|
2
|
|
|
|
|
962
|
has 'custom_attributes' => (is => 'rw', isa => Maybe[CustomAttributesType]); |
126
|
2
|
|
|
|
|
4053
|
has 'last_request_at' => (is => 'rw', isa => Maybe[Int]); |
127
|
2
|
|
|
|
|
951
|
has 'session_count' => (is => 'ro', isa => Maybe[Int]); |
128
|
2
|
|
|
|
|
915
|
has 'avatar' => (is => 'ro', isa => Maybe[AvatarType]); |
129
|
2
|
|
|
|
|
5097
|
has 'unsubscribed_from_emails' => (is => 'rw', isa => Maybe[Bool]); |
130
|
2
|
|
|
|
|
1879
|
has 'location_data' => (is => 'ro', isa => Maybe[LocationDataType]); |
131
|
2
|
|
|
|
|
13074
|
has 'user_agent_data' => (is => 'ro', isa => Maybe[Str]); |
132
|
2
|
|
|
|
|
871
|
has 'last_seen_ip' => (is => 'ro', isa => Maybe[IPAddressType]); |
133
|
2
|
|
|
|
|
2861
|
has 'companies' => (is => 'ro', isa => Maybe[CompaniesListType]); |
134
|
2
|
|
|
|
|
5609
|
has 'social_profiles' => (is => 'ro', isa => Maybe[SocialProfileListType]); |
135
|
2
|
|
|
|
|
6427
|
has 'segments' => (is => 'ro', isa => Maybe[SegmentsListType]); |
136
|
2
|
|
|
|
|
5780
|
has 'tags' => (is => 'ro', isa => Maybe[TagsListType]); |
137
|
|
|
|
|
|
|
|
138
|
2
|
|
|
|
|
5925
|
has 'intercom' => (is => 'ro', isa => InstanceOf["WebService::Intercom"], required => 1); |
139
|
|
|
|
|
|
|
|
140
|
2
|
0
|
|
2
|
|
3875
|
method save() { |
|
2
|
0
|
|
0
|
|
5
|
|
|
2
|
|
|
|
|
184
|
|
|
2
|
|
|
|
|
1612
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
$self->intercom->user_create_or_update($self); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
2
|
0
|
|
2
|
|
1804
|
method delete() { |
|
2
|
0
|
|
0
|
|
3
|
|
|
2
|
|
|
|
|
162
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
$self->intercom->user_delete($self); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
2
|
0
|
0
|
2
|
|
15653
|
multi method tag(Str :$name) { |
|
2
|
0
|
0
|
2
|
|
4
|
|
|
2
|
0
|
|
2
|
|
320
|
|
|
2
|
0
|
|
0
|
|
9
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
0
|
|
|
|
439
|
|
|
2
|
0
|
|
|
|
12
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
|
|
|
|
256
|
|
|
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
|
|
10813
|
multi method tag(WebService::Intercom::Tag $tag) { |
|
2
|
0
|
|
2
|
|
5
|
|
|
2
|
0
|
|
0
|
|
474
|
|
|
2
|
0
|
|
|
|
13
|
|
|
2
|
0
|
|
|
|
2
|
|
|
2
|
0
|
|
|
|
205
|
|
|
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
|
|
4853
|
method untag(Str :$name) { |
|
2
|
0
|
0
|
2
|
|
5
|
|
|
2
|
0
|
|
2
|
|
189
|
|
|
2
|
0
|
|
0
|
|
8
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
|
|
|
|
440
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
202
|
|
|
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
|
|
6617
|
Str :$body?) { |
|
2
|
0
|
0
|
2
|
|
5
|
|
|
2
|
0
|
|
2
|
|
198
|
|
|
2
|
0
|
|
2
|
|
9
|
|
|
2
|
0
|
|
0
|
|
4
|
|
|
2
|
0
|
|
|
|
450
|
|
|
2
|
0
|
|
|
|
8
|
|
|
2
|
0
|
|
|
|
3
|
|
|
2
|
|
|
|
|
221
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
210
|
|
|
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
|
|
10411
|
EventMetadataType :$metadata? where { scalar(keys %$_) <= 5 }) { |
|
2
|
0
|
0
|
2
|
|
5
|
|
|
2
|
0
|
0
|
2
|
|
210
|
|
|
2
|
0
|
0
|
2
|
|
8
|
|
|
2
|
0
|
0
|
2
|
|
4
|
|
|
2
|
0
|
0
|
0
|
|
475
|
|
|
2
|
0
|
0
|
|
|
10
|
|
|
2
|
0
|
0
|
|
|
2
|
|
|
2
|
0
|
0
|
|
|
285
|
|
|
2
|
0
|
0
|
|
|
10
|
|
|
2
|
0
|
0
|
|
|
2
|
|
|
2
|
0
|
0
|
|
|
282
|
|
|
2
|
0
|
0
|
|
|
8
|
|
|
2
|
0
|
|
|
|
4
|
|
|
2
|
0
|
|
|
|
1357
|
|
|
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; |