Intercom/User.pm

filter: Statementstmt 52.2% 166 / 318 Branchbran 0.0% 0 / 118 Conditioncond 0.0% 0 / 60 MC/DCmcdc 0.0% 0 / 29 Subroutinesub 87.5% 49 / 56 Podpod n/a totaltotal 37.0% 215 / 581 CC 86 SCAR 56.6
CC
86
Cov
33%
add_event
964.5
tag
101.6
add_note
92.2
CRAP 287.6
« Intercom.pm ↑ Summary Intercom/Exception.pm »
1 2 ▶use Moops -strict;
Subroutine __ANON__: called CC=1 SCAR=0.0
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 2  
116 2 ▶class WebService::Intercom::User types WebService::Intercom::Types {
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=2.6
117 2 has 'type' => (is => 'ro');
118 2 has 'id' => (is => 'ro');
119 2 has 'created_at' => (is => 'rw', isa => Maybe[Int]);
120 2 has 'signed_up_at' => (is => 'rw', isa => Maybe[Int]);
121 2 has 'updated_at' => (is => 'rw', isa => Maybe[Int]);
122 2 has 'user_id' => (is => 'rw', isa => Maybe[Str]);
123 2 has 'email' => (is => 'rw', isa => Maybe[Str]);
124 2 has 'name' => (is => 'rw', isa => Maybe[Str]);
125 2 has 'custom_attributes' => (is => 'rw', isa => Maybe[CustomAttributesType]);
126 2 has 'last_request_at' => (is => 'rw', isa => Maybe[Int]);
127 2 has 'session_count' => (is => 'ro', isa => Maybe[Int]);
128 2 has 'avatar' => (is => 'ro', isa => Maybe[AvatarType]);
129 2 has 'unsubscribed_from_emails' => (is => 'rw', isa => Maybe[Bool]);
130 2 has 'location_data' => (is => 'ro', isa => Maybe[LocationDataType]);
131 2 has 'user_agent_data' => (is => 'ro', isa => Maybe[Str]);
132 2 has 'last_seen_ip' => (is => 'ro', isa => Maybe[IPAddressType]);
133 2 has 'companies' => (is => 'ro', isa => Maybe[CompaniesListType]);
134 2 has 'social_profiles' => (is => 'ro', isa => Maybe[SocialProfileListType]);
135 2 has 'segments' => (is => 'ro', isa => Maybe[SegmentsListType]);
136 2 has 'tags' => (is => 'ro', isa => Maybe[TagsListType]);
137  
138 2 has 'intercom' => (is => 'ro', isa => InstanceOf["WebService::Intercom"], required => 1);
139  
140 0 ▶ method save() {
Subroutine BEGIN: called CC=1 SCAR=2.3
Subroutine save: not called CC=3 SCAR=17.3
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
141 0 $self->intercom->user_create_or_update($self);
142 }
143  
144 0 ▶ method delete() {
Subroutine BEGIN: called CC=1 SCAR=2.3
Subroutine delete: not called CC=3 SCAR=17.3
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
145 0 $self->intercom->user_delete($self);
146 }
147  
148 0 ▶ multi method tag(Str :$name) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine tag: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'name'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"name"}) 0 0 0
Type::Tiny::XS::Str($name) or _failed_check(9, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
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 0 ▶ multi method tag(WebService::Intercom::Tag $tag) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine tag: not called CC=9 SCAR=39.4
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC4($tag) or _failed_check(133, "InstanceOf[\"WebService::Intercom::Tag\"]", $tag, "exception_class", "Error::TypeTiny::Assertion") 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 0 ▶ method untag(Str :$name) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine untag: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'name'} ? : 0 0 0
if (exists $_{"name"}) 0 0 0
Type::Tiny::XS::Str($name) or _failed_check(9, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
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 0 ▶ Str :$body?) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine add_note: not called CC=14 SCAR=45.2
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'admin_id'} ? : 0 0 0
if (exists $_{"admin_id"}) 0 0 0
Type::Tiny::XS::Str($admin_id) or _failed_check(9, "Str", $admin_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'body'} ? : 0 0 0
if (exists $_{"body"}) 0 0 0
Type::Tiny::XS::Str($body) or _failed_check(9, "Str", $body, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
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 0 ▶ EventMetadataType :$metadata? where { scalar(keys %$_) <= 5 }) {
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine add_event: not called CC=38 SCAR=68.7
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'event_name'} ? : 0 0 0
if (exists $_{"event_name"}) 0 0 0
defined $event_name and not ref $event_name and not !($event_name =~ qr/(?^u:^[^[.\$]+$)/u) or _failed_check(100, "EventNameType", $event_name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'created_at'} ? : 0 0 0
if (exists $_{"created_at"}) 0 0 0
Type::Tiny::XS::AUTO::TC5($created_at) or _failed_check(134, "Maybe[Int]", $created_at, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($metadata) and do { my $ok = 1; foreach my $v (values %{$metadata;}) { $ok = 0, last unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } }; } ; foreach my $k (keys %{$metadata;}) { $ok = 0, last unless Type::Tiny::XS::Str($k); } ; $ok } } or _failed_check(108, "EventMetadataType", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } } 0 0 0
unless Type::Tiny::XS::Str($k) 0 0 0
do { local $_ = $metadata; $Kavorka::Parameter::PARAMS[13]{"constraints"}[0]->() } or Carp::croak("\$metadata failed value constraint") 0 0 0
Condition0%0/51
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $event_name and not ref $event_name and not !($event_name =~ qr/(?^u:^[^[.\$]+$)/u)
!ll&&!rl&&r
000
defined $event_name and not ref $event_name
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($metadata) && do { my $ok = 1; foreach my $v (values %{$metadata;}) { $ok = 0, last unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{'url'} and do { Type::Tiny::XS::Str($v->{'url'}) } and !exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{'amount'} and do { Type::Tiny::XS::Int($v->{'amount'}) } and exists $v->{'currency'} and do { Type::Tiny::XS::Str($v->{'currency'}) } }; } ; foreach my $k (keys %{$metadata;}) { $ok = 0, last unless Type::Tiny::XS::Str($k); } ; $ok }
!ll&&!rl&&r
000
defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } }
l!l&&r!l&&!r
000
defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } }
l!l&&r!l&&!r
000
defined $v and not ref $v
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) && !grep((!/\A(?:url|value)\z/u), keys %{$v;}) && exists $v->{'url'} && do { Type::Tiny::XS::Str($v->{'url'}) } && (!exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) })
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) }
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"}
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;})
!ll&&!rl&&r
000
not exists $v->{"value"} or do { Type::Tiny::XS::Str($v->{"value"}) }
l!l&&r!l&&!r
000
Ref::Util::XS::is_plain_hashref($v) && !grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) && exists $v->{'amount'} && do { Type::Tiny::XS::Int($v->{'amount'}) } && exists $v->{'currency'} && do { Type::Tiny::XS::Str($v->{'currency'}) }
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"}
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) }
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"}
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;})
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $event_name and not ref $event_name and not !($event_name =~ qr/(?^u:^[^[.\$]+$)/u)
defined $event_name not ref $event_name not !($event_name =~ qr/(?^u:^[^[.\$]+$)/u)
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($metadata) && do { my $ok = 1; foreach my $v (values %{$metadata;}) { $ok = 0, last unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{'url'} and do { Type::Tiny::XS::Str($v->{'url'}) } and !exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{'amount'} and do { Type::Tiny::XS::Int($v->{'amount'}) } and exists $v->{'currency'} and do { Type::Tiny::XS::Str($v->{'currency'}) } }; } ; foreach my $k (keys %{$metadata;}) { $ok = 0, last unless Type::Tiny::XS::Str($k); } ; $ok }
Ref::Util::XS::is_plain_hashref($metadata) do { my $ok = 1; foreach my $v (values %{$metadata;}) { $ok = 0, last unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{'url'} and do { Type::Tiny::XS::Str($v->{'url'}) } and !exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{'amount'} and do { Type::Tiny::XS::Int($v->{'amount'}) } and exists $v->{'currency'} and do { Type::Tiny::XS::Str($v->{'currency'}) } }; } ; foreach my $k (keys %{$metadata;}) { $ok = 0, last unless Type::Tiny::XS::Str($k); } ; $ok }
MC/DC0%0/4
defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } }
defined $v not ref $v do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } } do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } }
MC/DC0%0/6
Ref::Util::XS::is_plain_hashref($v) && !grep((!/\A(?:url|value)\z/u), keys %{$v;}) && exists $v->{'url'} && do { Type::Tiny::XS::Str($v->{'url'}) } && (!exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) })
Ref::Util::XS::is_plain_hashref($v) not grep((!/\A(?:url|value)\z/u), keys %{$v;}) exists $v->{"url"} do { Type::Tiny::XS::Str($v->{"url"}) } not exists $v->{"value"} do { Type::Tiny::XS::Str($v->{"value"}) }
MC/DC0%0/6
Ref::Util::XS::is_plain_hashref($v) && !grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) && exists $v->{'amount'} && do { Type::Tiny::XS::Int($v->{'amount'}) } && exists $v->{'currency'} && do { Type::Tiny::XS::Str($v->{'currency'}) }
Ref::Util::XS::is_plain_hashref($v) not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) exists $v->{"amount"} do { Type::Tiny::XS::Int($v->{"amount"}) } exists $v->{"currency"} do { Type::Tiny::XS::Str($v->{'currency'}) }
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $event_nameB= not ref $event_nameC= not !($event_name =~ qr/(?^u:^[^[.\$]+$)/u)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($metadata)B= do { my $ok = 1; foreach my $v (values %{$metadata;}) { $ok = 0, last unless defined $v and not ref $v or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{'url'} and do { Type::Tiny::XS::Str($v->{'url'}) } and !exists $v->{'value'} || do { Type::Tiny::XS::Str($v->{'value'}) } } or do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{'amount'} and do { Type::Tiny::XS::Int($v->{'amount'}) } and exists $v->{'currency'} and do { Type::Tiny::XS::Str($v->{'currency'}) } }; } ; foreach my $k (keys %{$metadata;}) { $ok = 0, last unless Type::Tiny::XS::Str($k); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/7
A and not(B) or C or D
A= defined $vB= not ref $vC= do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:url|value)\z/u), keys %{$v;}) and exists $v->{"url"} and do { Type::Tiny::XS::Str($v->{"url"}) } and !exists $v->{"value"} || do { Type::Tiny::XS::Str($v->{"value"}) } }D= do { Ref::Util::XS::is_plain_hashref($v) and not grep((!/\A(?:amount|currency)\z/u), keys %{$v;}) and exists $v->{"amount"} and do { Type::Tiny::XS::Int($v->{"amount"}) } and exists $v->{"currency"} and do { Type::Tiny::XS::Str($v->{"currency"}) } }
ABCDresult
11XX1
0X1X1
101X1
0X011
10011
0X000
10000
Truth table0%0/7
A and not(B) and C and D && not(E) or F
A= Ref::Util::XS::is_plain_hashref($v)B= not grep((!/\A(?:url|value)\z/u), keys %{$v;})C= exists $v->{"url"}D= do { Type::Tiny::XS::Str($v->{"url"}) }E= not exists $v->{"value"}F= do { Type::Tiny::XS::Str($v->{"value"}) }
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
1111000
11111X1
1111011
Truth table0%0/7
A and not(B) and C and D and E && F
A= Ref::Util::XS::is_plain_hashref($v)B= not grep((!/\A(?:amount|currency)\z/u), keys %{$v;})C= exists $v->{"amount"}D= do { Type::Tiny::XS::Int($v->{"amount"}) }E= exists $v->{"currency"}F= do { Type::Tiny::XS::Str($v->{'currency'}) }
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
190 0 $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 2 1;
« Intercom.pm ↑ Summary Intercom/Exception.pm »