NumberType.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class Services_Twilio_NumberType extends Services_Twilio_ListResource
  3. {
  4. public function getResourceName($camelized = false) {
  5. $this->instance_name = 'Services_Twilio_Rest_IncomingPhoneNumber';
  6. return $camelized ? 'IncomingPhoneNumbers' : 'incoming_phone_numbers';
  7. }
  8. /**
  9. * Purchase a new phone number.
  10. *
  11. * Example usage:
  12. *
  13. * .. code-block:: php
  14. *
  15. * $marlosBurner = '+14105551234';
  16. * $client->account->incoming_phone_numbers->local->purchase($marlosBurner);
  17. *
  18. * :param string $phone_number: The phone number to purchase
  19. * :param array $params: An optional array of parameters to pass along with
  20. * the request (to configure the phone number)
  21. */
  22. public function purchase($phone_number, array $params = array()) {
  23. $postParams = array(
  24. 'PhoneNumber' => $phone_number
  25. );
  26. return $this->create($postParams + $params);
  27. }
  28. public function create(array $params = array()) {
  29. return parent::_create($params);
  30. }
  31. }