<commit_before><?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;
 
/**
 *
 */
class MB_Toolbox_Mandrill extends MB_Toolbox_BaseService
{

  /**
   *
   */
  public function __construct() {

    parent::__construct();
    $this->transactionQueue = $this->mbConfig->getProperty('transactionalEmailQueue');
  }

 /**
  * generateMessage(): Generate message values based on Mandrill Send-Template requirements.
  *
  * @param array $settings
  *   Values to be used to generate message markup based on Mandrill API documentation:
  *   Send-Template: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
  *   https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
  *
  *     - activity => 'campaign_signup_digest'
  *     - email => '<EMAIL>'
  *     - merge_vars =>
  *       - INTRODUCTION
  *       - CAMPAIGNS
  *       - RECOMMENDATIONS
  *     - user_language => 'en'
  *     - email_template => 'mb-transactional-digest-v0-0-1'
  *     - tags
  *       - drupal_campaign_signup
  *       - transactional_digest
  *     - activity_timestamp
  *     - application_id => US
  *
  *   Note: There's now support for "long SMS messages" of 2500 characters.
  */
  public function generateMessage($settings) {

    $markup = '';
    foreach($settings as $campaignMarkup) {
      $markup .= $campaignMarkup;
    }

    return $markup;
 }
 
 /**
  * dispatch(): Send message to transactionalQueue to trigger sending transactional Mobile Commons message.
  *
  *   Send SMS Message: https://secure.mcommons.com/api/send_message
  *   https://mobilecommons.zendesk.com/hc/en-us/articles/202052534-REST-API#SendSMSMessage.
  *
  * @param array $message
  *   Values to create message for processing in transactionalQueue.
  */
  public function dispatchMessage($message) {

 }
 
}

/*
(
    [activity] => campaign_signup
    [email] => <EMAIL>
    [uid] => 3887635
    [merge_vars] => Array
        (
            [MEMBER_COUNT] => 5.3 million
            [FNAME] => Emily
            [CAMPAIGN_TITLE] => Bubble Breaks
            [CAMPAIGN_LINK] => https://www.dosomething.org/campaigns/bubble-breaks?source=node/1524
            [CALL_TO_ACTION] => Create homemade bubble blowing kits for kids at a family shelter. 
            [STEP_ONE] => Create and Decorate!
            [STEP_TWO] => Snap a Pic
            [STEP_THREE] => Drop It Off
        )

    [user_country] => US
    [user_language] => en
    [campaign_language] => en-global
    [campaign_country] => global
    [email_template] => mb-campaign-signup-US
    [subscribed] => 1
    [event_id] => 1524
    [email_tags] => Array
        (
            [0] => 1524
            [1] => drupal_campaign_signup<commit_msg>Add support for creating campaign and campaigns markup for service<commit_after><?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;
 
/**
 *
 */
class MB_Toolbox_Mandrill extends MB_Toolbox_BaseService
{

  /**
   *
   */
  public function __construct() {

    parent::__construct();
    $this->transactionQueue = $this->mbConfig->getProperty('transactionalEmailQueue');
  }

 /**
  * generateCampaignMarkup(): Generate campaign specific row HTML markup for email.
  *
  * @param array $settings
  *   Campaign Values to be used to generate campaign row markup.
  *
  * @return string $markup
  *   HTML markup
  *
  */
   public function generateCampaignMarkup($settings) {

     $markup = 'MB_Toolbox_Mandrill - GENERATED CAMPAIGN MARKUP';

     return $markup;
  }

 /**
  * generateCampaignsMarkup(): Generate message values based on Mandrill Send-Template requirements.
  *
  * @param array $settings
  *
  */
  public function generateCampaignsMarkup($settings) {

    $markup = 'MB_Toolbox_Mandrill - CAMPAIGNS MARKUP';

    return $markup;
 }

  /**
  * generateMessage(): Generate message values based on Mandrill Send-Template requirements.
  *
  * @param array $settings
  *   Values to be used to generate message markup based on Mandrill API documentation:
  *   Send-Template: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
  *   https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
  *
  *     - activity => 'campaign_signup_digest'
  *     - email => '<EMAIL>'
  *     - merge_vars =>
  *       - INTRODUCTION
  *       - CAMPAIGNS
  *       - RECOMMENDATIONS
  *     - user_language => 'en'
  *     - email_template => 'mb-transactional-digest-v0-0-1'
  *     - tags
  *       - drupal_campaign_signup
  *       - transactional_digest
  *     - activity_timestamp
  *     - application_id => US
  *
  *   Note: There's now support for "long SMS messages" of 2500 characters.
  */
  public function generateMessage($settings) {

    $markup = 'MANDRILL MESSAGE';

    return $markup;
  }
 
 /**
  * dispatch(): Send message to transactionalQueue to trigger sending transactional Mobile Commons message.
  *
  *   Send SMS Message: https://secure.mcommons.com/api/send_message
  *   https://mobilecommons.zendesk.com/hc/en-us/articles/202052534-REST-API#SendSMSMessage.
  *
  * @param array $message
  *   Values to create message for processing in transactionalQueue.
  */
  public function dispatchMessage($message) {

  }

}

/*
(
    [activity] => campaign_signup
    [email] => <EMAIL>
    [uid] => 3887635
    [merge_vars] => Array
        (
            [MEMBER_COUNT] => 5.3 million
            [FNAME] => Emily
            [CAMPAIGN_TITLE] => Bubble Breaks
            [CAMPAIGN_LINK] => https://www.dosomething.org/campaigns/bubble-breaks?source=node/1524
            [CALL_TO_ACTION] => Create homemade bubble blowing kits for kids at a family shelter. 
            [STEP_ONE] => Create and Decorate!
            [STEP_TWO] => Snap a Pic
            [STEP_THREE] => Drop It Off
        )

    [user_country] => US
    [user_language] => en
    [campaign_language] => en-global
    [campaign_country] => global
    [email_template] => mb-campaign-signup-US
    [subscribed] => 1
    [event_id] => 1524
    [email_tags] => Array
        (
            [0] => 1524
            [1] => drupal_campaign_signup
{'fraction_non_alphanumeric': 0.11965951874283844, 'fraction_numerical': 0.013095432967752497, 'mean_word_length': 2.6412395709177594, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 69, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7244395', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1896, 'n_words': 411}