当前位置: 首页>>代码示例>>PHP>>正文


PHP CASHSystem::getAPICredentials方法代码示例

本文整理汇总了PHP中CASHSystem::getAPICredentials方法的典型用法代码示例。如果您正苦于以下问题:PHP CASHSystem::getAPICredentials方法的具体用法?PHP CASHSystem::getAPICredentials怎么用?PHP CASHSystem::getAPICredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CASHSystem的用法示例。


在下文中一共展示了CASHSystem::getAPICredentials方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: manageWebhooks

 protected function manageWebhooks($list_id, $action = 'add')
 {
     $api_connection = $this->getConnectionAPI($list_id);
     if ($api_connection) {
         // connection found, api instantiated
         switch ($api_connection['connection_type']) {
             case 'com.mailchimp':
                 $mc = $api_connection['api'];
                 // webhooks
                 $api_credentials = CASHSystem::getAPICredentials();
                 $webhook_api_url = CASH_API_URL . '/verbose/people/processwebhook/origin/com.mailchimp/list_id/' . $list_id . '/api_key/' . $api_credentials['api_key'];
                 if ($action == 'remove') {
                     return $mc->listWebhookDel($webhook_api_url);
                 } else {
                     return $mc->listWebhookAdd($webhook_api_url, $actions = null, $sources = null);
                     // TODO: What do we do when adding a webhook fails?
                     // TODO: Try multiple times?
                 }
                 break;
             default:
                 // confused, return false
                 return false;
         }
     } else {
         // no connection, simply return true
         return true;
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:28,代码来源:PeoplePlant.php

示例2: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (!isset($data['key'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         require_once CASH_PLATFORM_ROOT . '/lib/mandrill/Mandrill.php';
         $m = new Mandrill($data['key']);
         $user_info = $m->getUserInfo();
         $username = $user_info['username'];
         // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
         // calls would only happen in the admin. If this changes we can fuck around with it later.
         $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
         $result = $new_connection->setSettings($username . ' (Mandrill)', 'com.mandrillapp', array('key' => $data['key']));
         if (!$result) {
             return 'There was an error. (adding the connection) Please try again.';
         }
         // set up webhooks
         $api_credentials = CASHSystem::getAPICredentials();
         $webhook_api_url = CASH_API_URL . '/verbose/people/processwebhook/origin/com.mandrillapp/api_key/' . $api_credentials['api_key'];
         //$m->webhooksDelete($webhook_api_url); // remove duplicate webhooks
         //$m->webhooksAdd($webhook_api_url,array('send','hard_bounce','soft_bounce','open','click','spam','unsub','reject')); // add it, all events
         $m->call('webhooks/add', array("url" => $webhook_api_url, "events" => array('hard_bounce', 'soft_bounce', 'open', 'click', 'spam', 'unsub', 'reject')));
         if (isset($data['return_result_directly'])) {
             return $result;
         } else {
             if ($result) {
                 AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
             } else {
                 AdminHelper::formFailure('Error. Something just didn\'t work right.');
             }
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:33,代码来源:MandrillSeed.php


注:本文中的CASHSystem::getAPICredentials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。