Creates a new SMS activity using the given information.

@param SmsActivity $activity The information of the activity to create

@return SmsActivity

@deprecated since version 0.8, to be removed in 0.9. Use SmsActivityApi::create() instead.
185380
public function addSms(SmsActivity $activity): SmsActivity
    {
        @trigger_error(sprintf('The %s() method is deprecated since version 0.8. Use SmsActivityApi::create() instead.', __METHOD__), E_USER_DEPRECATED);

        /** @var SmsActivityApi $apiHandler */
        $apiHandler = $this->closeIoApiWrapper->getSmsActivitiesApi();

        return $apiHandler->create($activity);
    }
93988
public function addActivityModule(\CampaignChain\CoreBundle\Entity\ActivityModule $activityModules)
    {
        $this->activityModules[] = $activityModules;

        return $this;
    }
1235822
def create_activity!(*args)
      return unless self.public_activity_enabled?
      options = prepare_settings(*args)

      if call_hook_safe(options[:key].split('.').last)
        reset_activity_instance_options
        return PublicActivity::Adapter.create_activity!(self, options)
      end
    end
102539
public function setActivity(\CampaignChain\CoreBundle\Entity\Activity $activity)
    {
        $this->activity = $activity;

        return $this;
    }
946153
public function createActivity():Renderer
    {
        $name = $this->clean($this->get("request")->get("name"));
        $status = $this->get("request")->get("status");
        $namespace = $this->get("request")->get("namespace");

        if ($name == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Service name is empty : $namespace")));
        }

        if ($status == "" || !in_array($status, array("enabled", "disabled"))) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined status : $status")));
        }

        if ($namespace == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined namespace : $namespace")));
        }


        $fcore = json_decode(file_get_contents(FEnv::get("framework.config.core.services.file")));
        foreach ($fcore as $one) {
            if ($one == $name) {
                return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Service already exist")));
            }
        }

        $fcore->$name = new \stdClass();
        $fcore->$name->namespace = $namespace;
        $fcore->$name->status = $status;
        $fcore = json_encode($fcore, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.config.core.services.file"), $fcore);

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
459227
public static function getAgent(string $agent): Agent
    {
        if (!isset(self::$agents[$agent])) {
            throw new SmsAgentException('The agent "' . $agent . '" not registered!');
        }
        return self::$agents[$agent];
    }
394699
private function getDuration(Activity $activity, $now = null)
    {
        if ($activity->isComplete()) {
            $end = strtotime($activity->completed_at);
        } elseif (!empty($activity->started_at)) {
            $now = $now === null ? time() : $now;
            $end = $now;
        } else {
            $end = strtotime($activity->updated_at);
        }
        $start = !empty($activity->started_at) ? strtotime($activity->started_at) : strtotime($activity->created_at);

        return $end !== false && $start !== false && $end - $start > 0 ? $end - $start : null;
    }
682245
public function create(CallActivity $activity): CallActivity
    {
        $response = $this->client->post($this->prepareUrlForKey('add-call'), [], $activity->jsonSerialize());
        $responseData = $response->getDecodedBody();

        return new CallActivity($responseData);
    }
970753
public function setTexts(string $active, string $inactive)
    {
        $this->texts = [$active, $inactive];

        return $this;
    }
1152493
public static function create(Intent $intent = null): self
    {
        $confirmIntentDirective = new self();

        $confirmIntentDirective->type          = self::TYPE;
        $confirmIntentDirective->updatedIntent = $intent;

        return $confirmIntentDirective;
    }
1138204
protected function createPlivoDriver()
    {
        $config = $this->app['config']->get('sms.plivo', []);

        $provider = new PlivoSMS(
            $config['auth_id'],
            $config['auth_token']
        );

        return $provider;
    }
1230287
public static function createFromLocation(Location $location): self
    {
        $message = new self();
        $message->setId($location->getId());
        $message->setTel($location->getTel());
        $message->setFax($location->getFax());
        $message->setMail($location->getMail());
        $message->setAddress($location->getAddress());
        $message->setPostalCode($location->getPostalCode());
        $message->setTown($location->getTown());
        $message->setCountry($location->getCountry());
        $message->setDefaultLocation($location->isDefaultLocation());
        $message->setLatitude($location->getLatitude());
        $message->setLongitude($location->getLongitude());

        foreach ($location->getTranslations() as $translation) {
            $transMessage = LocationTranslationMessage::createFromLocationTranslation($translation);

            $message->addTranslation($transMessage);
        }

        return $message;
    }
953139
public static function make($agentName = null, $tempId = null)
    {
        $sms = new self();
        $sms->type(self::TYPE_SMS);
        if (is_array($agentName)) {
            $sms->template($agentName);
        } elseif ($agentName && is_string($agentName)) {
            if ($tempId === null) {
                $sms->content($agentName);
            } elseif (is_string($tempId) || is_int($tempId)) {
                $sms->template($agentName, "$tempId");
            }
        }

        return $sms;
    }
325013
public function getIcons($activity)
    {
        $icon['location_icon'] = $this->twigExt->mediumIcon($activity->getLocation());
        $icon['activity_icon'] = '/'.$this->twigExt->mediumContext($activity->getLocation());

        return $icon;
    }
246978
public function deleteActivty(Activity $activity)
    {
        $this->om->remove($activity);
        $this->om->flush();
    }
565959
public function addNote(NoteActivity $activity)
    {
        @trigger_error(sprintf('The %s() method is deprecated since version 0.8. Use NoteActivityApi::create() instead.', __METHOD__), E_USER_DEPRECATED);

        /** @var NoteActivityApi $apiHandler */
        $apiHandler = $this->closeIoApiWrapper->getNoteActivitiesApi();

        return $apiHandler->create($activity);
    }
1151417
public function activity($target, $text, $suggestedActions = [])
    {
        $json = [
            'type' => 'message/text',
            'text' => $text,
        ];

        if (!empty($suggestedActions)) {
            $json['suggestedActions']['actions'] = $suggestedActions;
        }

        return $this->request('POST', '/v3/conversations/' . $target . '/activities', [
            'json' => $json
        ]);
    }