UsageTriggers.php 1.2 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. class Services_Twilio_Rest_UsageTriggers extends Services_Twilio_ListResource {
  3. public function __construct($client, $uri) {
  4. $uri = preg_replace("#UsageTriggers#", "Usage/Triggers", $uri);
  5. parent::__construct($client, $uri);
  6. }
  7. /**
  8. * Create a new UsageTrigger
  9. * @param string $category The category of usage to fire a trigger for. A full list of categories can be found in the `Usage Categories documentation <http://www.twilio.com/docs/api/rest/usage-records#usage-categories>`_.
  10. * @param string $value Fire the trigger when usage crosses this value.
  11. * @param string $url The URL to request when the trigger fires.
  12. * @param array $params Optional parameters for this trigger. A full list of parameters can be found in the `Usage Trigger documentation <http://www.twilio.com/docs/api/rest/usage-triggers#list-post-optional-parameters>`_.
  13. * @return Services_Twilio_Rest_UsageTrigger The created trigger
  14. */
  15. function create($category, $value, $url, array $params = array()) {
  16. return parent::_create(array(
  17. 'UsageCategory' => $category,
  18. 'TriggerValue' => $value,
  19. 'CallbackUrl' => $url,
  20. ) + $params);
  21. }
  22. }