How to use the groupy.api.messages.Message function in groupy

To help you get started, we’ve selected a few groupy 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 rhgrant10 / Groupy / tests / api / test_messages.py View on Github external
def setUp(self):
        self.m_manager = mock.Mock()
        data = base.get_fake_message_data()
        self.message = messages.Message(self.m_manager, **data)
github rhgrant10 / Groupy / groupy / api / messages.py View on Github external
def _get_messages(self, path=None, **params):
        url = utils.urljoin(self.url, path)
        response = self.session.get(url, params=params)
        messages = response.data['messages']
        return [Message(self, **message) for message in messages]
github rhgrant10 / Groupy / groupy / api / messages.py View on Github external
:rtype: :class:`~groupy.api.messages.Message`
        """
        message = {
            'source_guid': source_guid or str(time.time()),
        }

        if text is not None:
            message['text'] = text

        if attachments is not None:
            message['attachments'] = [a.to_json() for a in attachments]

        payload = {'message': message}
        response = self.session.post(self.url, json=payload)
        message = response.data['message']
        return Message(self, **message)
github rhgrant10 / Groupy / groupy / api / messages.py View on Github external
def _raw_list(self, **params):
        response = self.session.get(self.url, params=params)
        if response.status_code == 304:
            return []
        messages = response.data['messages']
        return [Message(self, **message) for message in messages]