/**
  * Get forwards for a given campaign
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param string $campaignId - Campaign id
  * @param array $params - query param to be appended to request
  * @return ResultSet - Containing a results array of {@link ForwardActivity}
  */
 public function getForwards($accessToken, $campaignId, array $params = array())
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.campaign_tracking_forwards'), $campaignId);
     $url = $this->buildUrl($baseUrl, $params);
     $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken));
     $body = json_decode($response->body, true);
     $forwards = array();
     foreach ($body['results'] as $forward_activity) {
         $forwards[] = ForwardActivity::create($forward_activity);
     }
     return new ResultSet($forwards, $body['meta']);
 }
 public function testGetForwards()
 {
     $response = self::$client->get('/')->json();
     $resultSet = new ResultSet($response['results'], $response['meta']);
     $forwardActivity = ForwardActivity::create($resultSet->results[0]);
     $this->assertInstanceOf('Ctct\\Components\\ResultSet', $resultSet);
     $this->assertInstanceOf('Ctct\\Components\\Tracking\\ForwardActivity', $forwardActivity);
     $this->assertEquals("bGltaXQ9MyZuZXh0PTEzNTQ4MTcyMTA0MzA", $resultSet->next);
     $this->assertEquals("EMAIL_FORWARD", $forwardActivity->activity_type);
     $this->assertEquals(1100394165290, $forwardActivity->campaign_id);
     $this->assertEquals("74", $forwardActivity->contact_id);
     $this->assertEquals("*****@*****.**", $forwardActivity->email_address);
     $this->assertEquals("2012-12-06T13:07:06.810Z", $forwardActivity->forward_date);
 }
 /**
  * Get forwards for a given campaign
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param string $campaignId - Campaign id
  * @param array $params - associative array of query parameters and values to append to the request.
  *      Allowed parameters include:
  *      limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50.
  *      created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
  *      next - the next link returned from a previous paginated call. May only be used by itself.
  * @return ResultSet - Containing a results array of {@link ForwardActivity}
  * @throws CtctException
  */
 public function getForwards($accessToken, $campaignId, array $params = array())
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.campaign_tracking_forwards'), $campaignId);
     $request = parent::createBaseRequest($accessToken, 'GET', $baseUrl);
     if ($params) {
         $query = $request->getQuery();
         foreach ($params as $name => $value) {
             $query->add($name, $value);
         }
     }
     try {
         $response = parent::getClient()->send($request);
     } catch (ClientException $e) {
         throw parent::convertException($e);
     }
     $body = $response->json();
     $forwards = array();
     foreach ($body['results'] as $forward_activity) {
         $forwards[] = ForwardActivity::create($forward_activity);
     }
     return new ResultSet($forwards, $body['meta']);
 }