Пример #1
0
 /**
  * point to a
  * member and update
  *
  * @param params: set of arguments with
  * with memberId
  */
 public function updateMember($params)
 {
     $args = Ensure::Input($params);
     $url = URIResource::Make($this->path, array($this->id, "members", $args->val("memberId")));
     $member = $this->client->post($url, $args->get());
     return $this->member($member['id']);
 }
Пример #2
0
 /**
  * Update the gather DTMF
  * The only update allowed is state:completed
  * to stop the gather
  *
  * @return Gather 
  */
 public function stop()
 {
     $url = URIResource::Make($this->path, array($this->call_id, "gather", $this->id));
     $data = new DataPacket(array("state" => GATHER_STATES::completed));
     $this->client->post($url, $data->get());
     return Constructor::Make($this, $data->get());
 }
Пример #3
0
 /**
  * Send message with additional parameters
  * important rewrite in place of
  * more polymorphic style. 
  * i.e send(from, to, message, calback)
  *
  * @param args:  list of valid parameters
  */
 public function send($args)
 {
     $data = Ensure::Input($args);
     $url = URIResource::Make($this->path);
     if ($data->has("media")) {
         $data->add("media", (string) new MediaURL($data->val("media", $this)));
     }
     $message_id = Locator::Find($this->client->post($url, $data->get()));
     $data->add("id", $message_id);
     return Constructor::Make($this, $data->get(), array("messageId" => "id"));
 }
Пример #4
0
 /**
  * Get audio url
  * for conference member
  */
 public function getAudioUrl()
 {
     return URIResource::Make($this->path, array($this->conference, "members", "audio"));
 }
Пример #5
0
 /**
  * Provide number information
  * 
  * @param number: CNAM number
  */
 public function get($number = null)
 {
     $url = URIResource::Make($this->path, array($number));
     $data = $this->client->get($url, array(), true, false);
     return Constructor::Make($this, $data);
 }
Пример #6
0
 /**
  * TollFree version batch allocation
  *
  * @param params
  */
 public function batchAllocateTollFree($params)
 {
     $url = URIResource::Make($this->availablePath, array("tollFree"));
     $args = Ensure::Input($params);
     $data = $this->client->post($url, $args->get(), true, false, true);
     return new PhoneNumbersCollection(new DataPacketCollection($data));
 }
Пример #7
0
 /**
  * gets the audio
  * url for a resource
  * Usually this is extended by a model
  *
  */
 public function getAudioUrl()
 {
     return URIResource::Make($this->path, array($this->id));
 }
Пример #8
0
 /**
  * delete an auth token
  * given as a EndpointsToken
  * object more on this in types
  *
  * @returns boolean
  */
 public function deleteAuthToken(EndpointsToken $Token)
 {
     $url = URIResource::Make($this->path, array($this->id, 'tokens', $Token->token));
     return $this->client->delete($url);
 }
Пример #9
0
 /**
  * Upload new media.  
  * 
  * 
  * In remaking we need the url. As this is 
  * a PUT request no 'location' header would
  * be present [spec]
  *
  * we will need both the mediaName and url
  *
  * @param args
  * must contain fileName and file(path to file)
  */
 public function upload($args)
 {
     $args = Ensure::Input($args);
     $data = $args->get();
     $url = URIResource::Make($this->path, array($data["mediaName"]));
     if (isset($data['file'])) {
         $file = FileHandler::Read($data['file']);
     } else {
         $file = $this->data;
     }
     $this->client->put($url, $file);
     return Constructor::Make($this, array_merge(array("url" => $this->client->join($url)), $data));
 }
Пример #10
0
 /**
  * multiform send
  * messages output should
  * satisfy array
  */
 protected function postMessages()
 {
     $url = URIResource::Make($this->path);
     $messages = $this->client->post($url, $this->messages);
     return $messages;
 }
Пример #11
0
 /**
  * prototypal add. This needs
  * term to be set as a function 
  * in its caller it will be used
  * to initialize the resulting
  * object
  *
  * Conference->addMember 
  * should return
  * ConferenceMember
  *
  * @params: mix of function arguments as well as object prototypes, terms
  */
 public static function add()
 {
     $args = func_get_args();
     $that = self::get_this($args);
     $term = self::get_term($args);
     $url = URIResource::Make($that->path, array($that->id, $term));
     $id = Locator::Find($that->client->post($url, $args->get()));
     return $this->{$term}($id);
 }