File tree Expand file tree Collapse file tree 3 files changed +41
-51
lines changed
src/intercom/Service/config Expand file tree Collapse file tree 3 files changed +41
-51
lines changed Original file line number Diff line number Diff line change 22 "name" : " Intercom API (Event) v3" ,
33 "description" : " The Intercom API (Event) v3" ,
44 "operations" : {
5- "trackEvent " : {
5+ "createEvent " : {
66 "httpMethod" : " POST" ,
77 "parameters" : {
88 "created_at" : {
3434 },
3535 "summary" : " Records an event" ,
3636 "uri" : " /events"
37- },
38- "trackMultipleEvents" : {
39- "httpMethod" : " POST" ,
40- "parameters" : {
41- "type" : {
42- "default" : " event.list" ,
43- "location" : " json" ,
44- "required" : true ,
45- "static" : " true"
46- },
47- "data" : {
48- "type" : " array" ,
49- "location" : " json" ,
50- "required" : true ,
51- "items" : {
52- "name" : " event" ,
53- "type" : " object" ,
54- "properties" : {
55- "created_at" : {
56- "format" : " timestamp" ,
57- "location" : " json" ,
58- "required" : true ,
59- "type" : " integer"
60- },
61- "email" : {
62- "location" : " json" ,
63- "required" : false ,
64- "type" : " string"
65- },
66- "event_name" : {
67- "location" : " json" ,
68- "required" : true ,
69- "type" : " string"
70- },
71- "metadata" : {
72- "location" : " json" ,
73- "required" : false ,
74- "type" : " array"
75- },
76- "user_id" : {
77- "location" : " json" ,
78- "required" : false ,
79- "type" : " object"
80- }
81- }
82- }
83- }
84- },
85- "summary" : " Records multiple events at once" ,
86- "uri" : " /events"
8737 }
8838 }
8939}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Intercom ;
4+
5+ class EventTest extends IntercomTestCase
6+ {
7+ public function testCreateEvent ()
8+ {
9+ $ this ->setMockResponse ($ this ->client , 'Event/Event.txt ' );
10+ $ this ->client ->createEvent (['created_at ' => 1401970113 , 'event_name ' => 'invited-friend ' ]);
11+
12+ $ this ->assertRequest ('POST ' , '/events ' );
13+ $ this ->assertRequestJson (['created_at ' => 1401970113 , 'event_name ' => 'invited-friend ' ]);
14+ }
15+
16+ /**
17+ * @expectedException \Guzzle\Service\Exception\ValidationException
18+ */
19+ public function testCreateEventNoParameters ()
20+ {
21+ $ this ->client ->createEvent ();
22+ }
23+
24+ /**
25+ * @expectedException \Guzzle\Service\Exception\ValidationException
26+ */
27+ public function testCreateEventNoCreatedAt ()
28+ {
29+ $ this ->client ->createEvent (['event_name ' => 'invited-friend ' ]);
30+ }
31+
32+ /**
33+ * @expectedException \Guzzle\Service\Exception\ValidationException
34+ */
35+ public function testCreateEventNoEventName ()
36+ {
37+ $ this ->client ->createEvent (['created_at ' => 1401970113 ]);
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ HTTP/1.1 202 Accepted
You can’t perform that action at this time.
0 commit comments