How to use the zenpy.lib.api_objects.Ticket function in zenpy

To help you get started, we’ve selected a few zenpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facetoe / zenpy / tests / test_ticket_endpoint.py View on Github external
def create_tickets(self):
        """ Helper method for creating some tickets with the raw_subject set. """
        with self.recorder.use_cassette("{}-create".format(self.generate_cassette_name()), serialize_with='prettyjson'):
            tickets = list()
            for i in range(5):
                tickets.append(Ticket(subject=str(i), raw_subject=str(i), description="desc{}".format(i)))
            job_status = self.zenpy_client.tickets.create(tickets)
            self.wait_for_job_status(job_status)
            return tickets, [t for t in self.zenpy_client.tickets()]
github facetoe / zenpy / tests / test_api / test_generator.py View on Github external
def check_slice_range(self, values, slice_range):
        self.assertEqual(len(values), len(slice_range))

        for i, n in enumerate(slice_range):
            self.assertIsInstance(values[i], Ticket)
            self.assertTrue(values[i].id == n,
                            msg="expected Ticket id: {}, found: {}, values: {}".format(n, values[i], values))
github facetoe / zenpy / tests / test_cache / test_cache.py View on Github external
def populate_cache(self, num_objects):
        for i in range(num_objects):
            self.cache[i] = Ticket(id=i)
github facetoe / zenpy / tests / test_ticket_endpoint.py View on Github external
def generate_tickets(self, num_tickets):
        tickets = [Ticket(subject=str(i), description=str(i)) for i in range(num_tickets)]
        job_status = self.zenpy_client.tickets.create(tickets)
        self.wait_for_job_status(job_status)
github facetoe / zenpy / tests / test_ticket_endpoint.py View on Github external
def verify(self, ticket_count):
        returned_tickets = [t for t in self.zenpy_client.tickets()]
        self.assertEqual(len(returned_tickets), ticket_count)
        for ticket in returned_tickets:
            self.assertIsInstance(ticket, Ticket)
            self.assertInCache(ticket)
github facetoe / zenpy / tests / test_ticket_endpoint.py View on Github external
def setUp(self):
        super(TestTicketAPIMethods, self).setUp()
        cassette_name = "{}-create-test-ticket".format(self.generate_cassette_name())
        with self.recorder.use_cassette(cassette_name=cassette_name, serialize_with='prettyjson'):
            self.subject = "subject"
            self.comment = Comment(body="I am comment")
            ticket_audit = self.zenpy_client.tickets.create(Ticket(subject=self.subject, comment=self.comment))
            self.test_ticket = ticket_audit.ticket
github MTG / freesound / support / views.py View on Github external
zendesk_api.CustomField(id=30153569, value=last_login),
            zendesk_api.CustomField(id=30295025, value=num_sounds),
            zendesk_api.CustomField(id=30295045, value=num_posts),
            zendesk_api.CustomField(id=30153729, value=num_comments),
        ]

        user_url = "https://%s%s" % (
            Site.objects.get_current().domain,
            reverse('account', args=[user.username])
        )

        message += "\n\n-- \n%s" % user_url

        requester.name = user.username

    return zendesk_api.Ticket(
        requester=requester,
        subject=subject,
        description=message,
        custom_fields=custom_fields
    )
github facetoe / zenpy / zenpy / lib / manager.py View on Github external
if hasattr(o, 'to_dict'):
            return o.to_dict()
        elif isinstance(o, datetime):
            return o.date().isoformat()
        elif isinstance(o, date):
            return o.isoformat()


class ClassManager(object):
    """
    ClassManager provides methods for converting JSON objects
    to the correct Python ones.
    """

    class_mapping = {
        'ticket': Ticket,
        'user': User,
        'organization': Organization,
        'group': Group,
        'brand': Brand,
        'topic': Topic,
        'comment': Comment,
        'attachment': Attachment,
        'thumbnail': Thumbnail,
        'metadata': Metadata,
        'system': System,
        'create': CreateEvent,
        'change': ChangeEvent,
        'notification': NotificationEvent,
        'voicecomment': VoiceCommentEvent,
        'commentprivacychange': CommentPrivacyChangeEvent,
        'satisfactionrating': SatisfactionRatingEvent,