/**
  * Update contact details for a specific contact
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param Contact $contact - Contact to be updated
  * @param boolean $actionByVisitor - is the action being taken by the visitor 
  * @return Contact
  */
 public function updateContact($accessToken, Contact $contact, $actionByVisitor = false)
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contact->id);
     $params = array();
     if ($actionByVisitor == true) {
         $params['action_by'] = "ACTION_BY_VISITOR";
     }
     $url = $this->buildUrl($baseUrl, $params);
     $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $contact->toJson());
     return Contact::create(json_decode($response->body, true));
 }
Esempio n. 2
0
 /**
  * Update contact details for a specific contact
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param Contact $contact - Contact to be updated
  * @param array $params - query params to be appended to the request
  * @return Contact
  */
 public function updateContact($accessToken, Contact $contact, array $params = array())
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.contact'), $contact->id);
     $url = $this->buildUrl($baseUrl, $params);
     $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $contact->toJson());
     return Contact::create(json_decode($response->body, true));
 }