Exemplo n.º 1
0
 /**
  * Get an individual contact list
  * @param $accessToken - Constant Contact OAuth2 access token
  * @param $list_id - list id
  * @return ContactList
  */
 public function getList($accessToken, $list_id)
 {
     $baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.list'), $list_id);
     $url = $this->buildUrl($baseUrl);
     $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken));
     return ContactList::create(json_decode($response->body, true));
 }
Exemplo n.º 2
0
 /**
  * Factory method to create a Contact object from an array
  * @param array $props - Associative array of initial properties to set
  * @return Contact
  */
 public static function create(array $props)
 {
     $contact = new Contact();
     $contact->id = parent::getValue($props, "id");
     $contact->status = parent::getValue($props, "status");
     $contact->first_name = parent::getValue($props, "first_name");
     $contact->middle_name = parent::getValue($props, "middle_name");
     $contact->last_name = parent::getValue($props, "last_name");
     $contact->confirmed = parent::getValue($props, "confirmed");
     $contact->source = parent::getValue($props, "source");
     foreach ($props['email_addresses'] as $email_address) {
         $contact->email_addresses[] = EmailAddress::create($email_address);
     }
     $contact->prefix_name = parent::getValue($props, "prefix_name");
     $contact->job_title = parent::getValue($props, "job_title");
     foreach ($props['addresses'] as $address) {
         $contact->addresses[] = Address::create($address);
     }
     foreach ($props['notes'] as $note) {
         $contact->notes[] = Note::create($note);
     }
     $contact->company_name = parent::getValue($props, "company_name");
     $contact->home_phone = parent::getValue($props, "home_phone");
     $contact->work_phone = parent::getValue($props, "work_phone");
     $contact->cell_phone = parent::getValue($props, "cell_phone");
     $contact->fax = parent::getValue($props, "fax");
     foreach ($props['custom_fields'] as $custom_field) {
         $contact->custom_fields[] = CustomField::create($custom_field);
     }
     foreach ($props['lists'] as $contact_list) {
         $contact->lists[] = ContactList::create($contact_list);
     }
     $contact->source_details = parent::getValue($props, "source_details");
     return $contact;
 }
Exemplo n.º 3
0
 public function create_list($parameters)
 {
     return ContactList::create($parameters);
 }
Exemplo n.º 4
0
 /**
  * Factory method to create a Campaign object from an array
  * @param array $props - associative array of initial properties to set
  * @return Campaign
  */
 public static function create(array $props)
 {
     $campaign = new Campaign();
     $campaign->id = parent::getValue($props, "id");
     $campaign->name = parent::getValue($props, "name");
     $campaign->subject = parent::getValue($props, "subject");
     $campaign->from_name = parent::getValue($props, "from_name");
     $campaign->from_email = parent::getValue($props, "from_email");
     $campaign->reply_to_email = parent::getValue($props, "reply_to_email");
     $campaign->template_type = parent::getValue($props, "template_type");
     $campaign->created_date = parent::getValue($props, "created_date");
     $campaign->modified_date = parent::getValue($props, "modified_date");
     $campaign->last_run_date = parent::getValue($props, "last_run_date");
     $campaign->next_run_date = parent::getValue($props, "next_run_date");
     $campaign->status = parent::getValue($props, "status");
     $campaign->is_permission_reminder_enabled = parent::getValue($props, "is_permission_reminder_enabled");
     $campaign->permission_reminder_text = parent::getValue($props, "permission_reminder_text");
     $campaign->is_view_as_webpage_enabled = parent::getValue($props, "is_view_as_webpage_enabled");
     $campaign->view_as_web_page_text = parent::getValue($props, "view_as_web_page_text");
     $campaign->view_as_web_page_link_text = parent::getValue($props, "view_as_web_page_link_text");
     $campaign->greeting_salutations = parent::getValue($props, "greeting_salutations");
     $campaign->greeting_name = parent::getValue($props, "greeting_name");
     $campaign->greeting_string = parent::getValue($props, "greeting_string");
     if (array_key_exists("message_footer", $props)) {
         $campaign->message_footer = MessageFooter::create($props['message_footer']);
     }
     if (array_key_exists("tracking_summary", $props)) {
         $campaign->tracking_summary = TrackingSummary::create($props['tracking_summary']);
     }
     $campaign->email_content = parent::getValue($props, "email_content");
     $campaign->email_content_format = parent::getValue($props, "email_content_format");
     $campaign->style_sheet = parent::getValue($props, "style_sheet");
     $campaign->text_content = parent::getValue($props, "text_content");
     $campaign->permalink_url = parent::getValue($props, "permalink_url");
     if (array_key_exists('sent_to_contact_lists', $props)) {
         foreach ($props['sent_to_contact_lists'] as $sent_to_contact_list) {
             $campaign->sent_to_contact_lists[] = ContactList::create($sent_to_contact_list);
         }
     }
     if (array_key_exists('click_through_details', $props)) {
         foreach ($props['click_through_details'] as $click_through_details) {
             $campaign->click_through_details[] = ClickThroughDetails::create($click_through_details);
         }
     }
     return $campaign;
 }