Exemple #1
0
    def get_email(self, email_id):
        """
        Get a specific email
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.EMAILS_ID_URL % email_id)

        return connection.get_request()
Exemple #2
0
    def get_single_SMS(self, sms_id):
        """
        Get a specific sms
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SMS_ID_URL % sms_id)

        return connection.get_request()
Exemple #3
0
    def get_signature(self, signature_id):
        """
        Get a concrete Signature
        @return Signature data
        """
        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_ID_URL % signature_id)

        return connection.get_request()
Exemple #4
0
    def get_brandings(self):
        """
        Get all account brandings
        @return List of brandings
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.BRANDINGS_URL)

        return connection.get_request()
Exemple #5
0
    def delete_subscription(self, subscription_id):
        """
        Delete single subscription
        """
        url = self.SUBSCRIPTIONS_ID_URL % subscription_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #6
0
    def get_groups(self, limit=100, offset=0):
        """
        Get all groups from your current team
        """
        url = self.TEAM_GROUPS_URL + "?limit=%s&offset=%s" % (limit, offset)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #7
0
    def get_group(self, group_id):
        """
        Get a single group
        """
        url = self.TEAM_GROUPS_ID_URL % group_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #8
0
    def delete_contact(self, contact_id):
        """
        Delete single contact
        """
        url = self.CONTACTS_ID_URL % contact_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #9
0
    def get_user(self, user_id):
        """
           Get a single user
        """
        url = self.TEAM_USERS_ID_URL % user_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #10
0
    def cancel_signature(self, signature_id):
        """
        Cancel a concrete Signature
        @signature_id: Id of signature
        @return Signature data
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SIGNS_CANCEL_URL % signature_id)

        return connection.patch_request()
Exemple #11
0
    def download_SMS_audit_trail(self, sms_id, certificate_id):
        connection = Connection(self.token)

        connection.set_url(self.production, self.SMS_AUDIT_TRAIL % (sms_id, certificate_id))

        response, headers = connection.file_request()

        if headers['content-type'] == 'application/json':
            return response

        return response
Exemple #12
0
    def send_signature_reminder(self, signature_id):
        """
        Send a reminder email
        @signature_id: Id of signature
        @document_id: Id of document
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SIGNS_SEND_REMINDER_URL % signature_id)

        return connection.post_request()
Exemple #13
0
    def get_branding(self, branding_id):
        """
        Get a concrete branding
        @branding_id: Id of the branding to fetch
        @return Branding
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.BRANDINGS_ID_URL % branding_id)

        return connection.get_request()
Exemple #14
0
    def get_templates(self, limit=100, offset=0):
        """
        Get all account templates
        """
        url = self.TEMPLATES_URL + "?limit=%s&offset=%s" % (limit, offset)

        connection = Connection(self.token)

        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #15
0
    def remove_seat(self, seat_id):
        """
        Remove a seat from your team
        :param seat_id: Id of user
        """

        url = self.TEAM_SEATS_ID_URL % seat_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #16
0
    def remove_user(self, user_id):
        """
        Remove a user from your team
        :param user_id: Id of user
        """

        url = self.TEAM_USERS_ID_URL % user_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #17
0
    def delete_group(self, group_id):
        """
        Remove a group from your team
        :param group_id: Id of group
        """

        url = self.TEAM_GROUPS_ID_URL % group_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #18
0
    def add_member_to_group(self, group_id, user_id):
        """
        Add a user to a group as a member
        :param group_id:
        :param user_id:
        """
        url = self.TEAM_MEMBERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.post_request()
Exemple #19
0
    def remove_manager_from_group(self, group_id, user_id):
        """
        Add a user to a group as a member
        :param group_id:
        :param user_id:
        """
        url = self.TEAM_MANAGERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Exemple #20
0
    def download_audit_trail(self, signature_id, document_id):
        """
        Get the audit trail of concrete document
        @signature_id: Id of signature
        @document_id: Id of document
        """
        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_DOCUMENTS_AUDIT_URL % (signature_id, document_id))

        response, headers = connection.file_request()

        if headers['content-type'] == 'application/json':
            return response

        return response
Exemple #21
0
    def get_signatures(self, limit=100, offset=0, conditions={}):
        """
        Get all signatures
        """
        url = self.SIGNS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in conditions.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #22
0
    def count_subscriptions(self, params={}):
        """
        Count all subscriptions
        """
        url = self.SUBSCRIPTIONS_COUNT_URL + '?'

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #23
0
    def count_signatures(self, conditions={}):
        """
        Count all signatures
        """
        url = self.SIGNS_COUNT_URL + '?'

        for key, value in conditions.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #24
0
    def get_contacts(self, limit=100, offset=0, params={}):
        """
        Get all account contacts
        """
        url = self.CONTACTS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #25
0
    def get_subscriptions(self, limit=100, offset=0, params={}):
        """
        Get all subscriptions
        """
        url = self.SUBSCRIPTIONS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #26
0
    def count_SMS(self, conditions={}):
        """
        Count all certified sms
        """
        url = self.SMS_COUNT_URL + "?"

        for key, value in conditions.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.set_url(self.production, url)

        return connection.get_request()
Exemple #27
0
    def update_branding(self, branding_id, params):
        """
        Update a existing branding
        @branding_id: Id of the branding to update
        @params: Same params as method create_branding, see above
        @return: A dict with updated branding data
        """
        connection = Connection(self.token)

        connection.add_header('Content-Type', 'application/json')
        connection.set_url(self.production, self.BRANDINGS_ID_URL % branding_id)
        connection.add_params(params)

        return connection.patch_request()
Exemple #28
0
    def create_contact(self, email, name):
        """
        Create a new contact
        :param email: user email
        :param name: user name
        """
        params = {'email': email, 'name': name}

        url = self.CONTACTS_URL

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_header('Content-Type', 'application/json')
        connection.add_params(params, json_format=True)

        return connection.post_request()
Exemple #29
0
    def create_email(self, files, recipients, subject, body, params={}):
        """
        Create a new certified email

        @files
             Files to send
                ex: ['/documents/internet_contract.pdf', ... ]
        @recipients
            A dictionary with the email and fullname of the person you want to sign.
            If you wanna send only to one person:
               - [{"email": "*****@*****.**", "fullname": "John"}]
            For multiple recipients, yo need to submit a list of dicts:
               - [{"email": "*****@*****.**", "fullname": "John"}, {"email":"*****@*****.**", "fullname": "Bob"}]
        @subject
            Email subject
        @body
            Email body
        @params
        """
        parameters = {}

        parser = Parser()

        documents = {}

        parser.fill_array(documents, files, 'files')

        recipients = recipients if isinstance(recipients, list) else [recipients]

        index = 0
        for recipient in recipients:
            parser.fill_array(parameters, recipient, 'recipients[%i]' % index)

            index += 1

        parser.fill_array(parameters, params, '')

        parameters['subject'] = subject
        parameters['body'] = body

        connection = Connection(self.token)
        connection.set_url(self.production, self.EMAILS_URL)
        connection.add_params(parameters)
        connection.add_files(documents)

        return connection.post_request()
Exemple #30
0
    def update_group(self, group_id, name):
        """
        Change group name
        :param group_id: Id of group
        :param name: Group name
        """
        parameters = {
            'name': name
        }

        url = self.TEAM_GROUPS_ID_URL % group_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_header('Content-Type', 'application/json')
        connection.add_params(parameters)

        return connection.patch_request()