コード例 #1
0
ファイル: comment.py プロジェクト: sendjack/sendjack
    def post(self, id=None):
        object_dict = self._get_request_body()
        task_id = object_dict.get(self.TASK_ID)
        message = object_dict.get(self.MESSAGE)
        is_from_customer = object_dict.get(self.IS_FROM_CUSTOMER)

        if is_from_customer:
            email = unicode("{}-{}-{}@{}").format(
                    "sendjack",
                    task_id,
                    "comment",
                    settings.MAILGUN_DOMAIN)

            redflag.send_email_from_jack(
                    email,
                    "SUBJECT",
                    message)

        else:
            task_instance = TaskInstance.read(task_id)
            customer = Customer.read(task_instance.customer_id)

            full_name = customer.full_name
            email = customer.email

            recipient = unicode("{} <{}>").format(
                    full_name,
                    email)

            redflag.send_comment_on_task(
                    self.JACK_SERVICE,
                    task_id,
                    recipient,
                    message)
コード例 #2
0
ファイル: instance.py プロジェクト: sendjack/sendjack
    def _on_processed_status(self, instance):
        customer = Customer.read(instance.customer_id)

        # TODO: create a factory or static wrapper that chooses test or control
        # based on the parameters passed to instantiate it (ex: customer).
        if customer.control_group:
            status_message = ControlProcessedInstanceMessage(
                customer, instance)
        else:
            status_message = TestProcessedInstanceMessage(customer, instance)

        redflag.send_email_to_customer(customer, status_message.subject,
                                       status_message.body_text)
コード例 #3
0
ファイル: comment.py プロジェクト: sendjack/sendjack
    def post(self, id=None):
        object_dict = self._get_request_body()
        task_id = object_dict.get(self.TASK_ID)
        message = object_dict.get(self.MESSAGE)
        is_from_customer = object_dict.get(self.IS_FROM_CUSTOMER)

        if is_from_customer:
            email = unicode("{}-{}-{}@{}").format("sendjack", task_id,
                                                  "comment",
                                                  settings.MAILGUN_DOMAIN)

            redflag.send_email_from_jack(email, "SUBJECT", message)

        else:
            task_instance = TaskInstance.read(task_id)
            customer = Customer.read(task_instance.customer_id)

            full_name = customer.full_name
            email = customer.email

            recipient = unicode("{} <{}>").format(full_name, email)

            redflag.send_comment_on_task(self.JACK_SERVICE, task_id, recipient,
                                         message)
コード例 #4
0
ファイル: instance.py プロジェクト: sendjack/sendjack
 def _on_completed_status(self, instance):
     customer = Customer.read(instance.customer_id)
     status_message = CompletedInstanceMessage(customer, instance)
     redflag.send_email_to_customer(customer, status_message.subject,
                                    status_message.body_text)