function it_should_create_a_contact(Client $client) { $this->create('list_name', '*****@*****.**', ['content' => 'baz', 'subject' => 'subject']); $client->post(Resources::$Contact, ['body' => ['Email' => '*****@*****.**']])->shouldBeCalled(); $client->post(Resources::$Contactmetadata, ['body' => ['Datatype' => "str", 'Name' => "content_ListName", 'NameSpace' => "static"]])->shouldBeCalled(); $client->post(Resources::$Contactmetadata, ['body' => ['Datatype' => "str", 'Name' => "subject_ListName", 'NameSpace' => "static"]])->shouldBeCalled(); $client->put(Resources::$Contactdata, ['id' => '*****@*****.**', 'body' => ['Data' => [['Name' => "content_ListName", 'value' => 'baz'], ['Name' => "subject_ListName", 'value' => 'subject']]]])->shouldBeCalled(); }
/** * Trigger a POST request * * @param array $resource Mailjet Resource/Action pair * @param array $args Request arguments * * @return Response */ public function put($resource, $args = []) { $response = parent::put($resource, $args); $this->calls[] = ['method' => 'PUT', 'resource' => $resource, 'args' => $args, 'success' => $response->success(), 'response' => $response->getBody()]; return $resource; }