updateCard() public method

The addressbook id will be passed as the first argument. This is the same id as it is returned from the getAddressBooksForUser method. The cardUri is a base uri, and doesn't include the full path. The cardData argument is the vcard body, and is passed as a string. It is possible to return an ETag from this method. This ETag should match that of the updated resource, and must be enclosed with double quotes (that is: the string itself must contain the actual quotes). You should only return the ETag if you store the carddata as-is. If a subsequent GET request on the same card does not have the same body, byte-by-byte and you did return an ETag here, clients tend to get confused. If you don't return an ETag, you can just return null.
public updateCard ( mixed $addressBookId, string $cardUri, string $cardData ) : string | null
$addressBookId mixed
$cardUri string
$cardData string
return string | null
Example #1
0
 /**
  * @depends testGetCard
  */
 public function testUpdateCard()
 {
     $result = $this->backend->updateCard(1, 'card1', 'newdata');
     $this->assertEquals('"' . md5('newdata') . '"', $result);
     $result = $this->backend->getCard(1, 'card1');
     $this->assertEquals(1, $result['id']);
     $this->assertEquals('newdata', $result['carddata']);
 }
Example #2
0
 /**
  * @depends testGetCard
  */
 function testUpdateCard()
 {
     $result = $this->backend->updateCard(1, 'card1', 'newdata');
     $this->assertEquals('"' . md5('newdata') . '"', $result);
     $result = $this->backend->getCard(1, 'card1');
     $this->assertEquals(1, $result['id']);
     if (is_resource($result['carddata'])) {
         $result['carddata'] = stream_get_contents($result['carddata']);
     }
     $this->assertEquals('newdata', $result['carddata']);
 }