/** * 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']); }
/** * 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()); }
/** * 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")); }
/** * Get audio url * for conference member */ public function getAudioUrl() { return URIResource::Make($this->path, array($this->conference, "members", "audio")); }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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); }
/** * 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)); }
/** * multiform send * messages output should * satisfy array */ protected function postMessages() { $url = URIResource::Make($this->path); $messages = $this->client->post($url, $this->messages); return $messages; }
/** * 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); }