/** * Patch the given * application with new information * same as update/1 * * @param data: set of application data */ public function patch($data) { $data = Ensure::Input($data); $this->client->post($this->path . "/" . $this->id, $data->get()); // reload after recreating return Constructor::make($this, array("id" => $this->id), TRUE); }
/** * 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")); }
function __call($class, array $args = null) { if (is_null($this->_namespace)) { $qualified = $class; } else { $qualified = $this->_namespace . '\\' . $class; } $this->clear(); $rClass = $this->reflect($qualified); if ($rClass->isSubclassOf('Kinesis\\Reference') || $rClass->isSubclassOf('Kinesis\\Object')) { $instance = parent::__call($qualified, $args); } else { $instance = new Reference\Object(parent::__call($qualified, $args)); } if (!$instance instanceof Object) { self::initialise($instance, $class); } return $instance; }
/** * 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); }
/** * allocate a new number * number must be available * or warning will be thrown * @param args * number, * application (one you want to associate this number with) * fallback a fallback option if this isnt available */ public function allocate($args) { $data = Ensure::Input($args); $url = URIResource::Make($this->path); $id = Locator::Find($this->client->post($url, $data->get())); $data->add("id", $id); return Constructor::Make($this, $data->get()); }
public function update() { $data = Ensure::Input(func_get_args()); $url = URIResource::Make($this->path, array($this->id)); $this->client->post($url, $data->get()); return Constructor::Make($this, $data->get(), TRUE); }
/** * Add another to a call bridge * * @param caller -> PhoneNumber * @param callee -> PhoneNumber * @param args -> Call's arguments (see in function) */ public function callParty($caller, $callee, $args) { $new_call = Call::create($caller, $callee, $this->id, $args); $this->calls++; return Constructor::Make($this, $data->get()); }
/** * 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)); }
public function __construct(Clazz $clazz) { parent::__construct($clazz); }
/** * Reject an incoming call. Call id must already be passed * * @return void */ public function reject() { $url = URIResource::Make($this->path, array($this->id)); $data = new DataPacket(array("state" => CALL_STATES::rejected)); $this->client->post($url, $data->get()); return Constructor::Make($this, $data->get()); }
/** * Mock get functions * read whether we need to * use an id or not * then run accordingly * last parameter will always * be 'this' object */ public static function get() { $args = func_get_args(); $that = self::get_this($args); $term = self::get_term($args); $id = self::get_id($args); $plural = self::get_is_plural($args); if ($plural) { $url = URIResource::Make($that->path, array($that->id, GenericResource::getPath($term))); $dp = new DataPacketCollection($that->client->get($url)); $cl = GenericResource::getObjClass($term); $pobjcl = "Catapult\\" . $cl . "Collection"; $pobj = new $pobjcl($dp); return $pobj; } else { $url = URIResource::Make($that->path, array($that->id, GenericResource::getPath($term))); $dp = new DataPacket($that->client->get($url)); $cl = GenericResource::getObjClass($term); $pobjcl = "Catapult\\" . $cl; $pobj = new $pobjcl(); return Constructor::Make($pobj, $dp->get()); } return Constructor::Make($pobj, $dp->get()); }