Esempio n. 1
0
    def get_contacts(self, **params):
        """List contacts in an account.

        Documentation: http://context.io/docs/2.0/accounts/contacts#get

        Optional Arguments:
            search: string - String identifying the name or the email address
                of the contact(s) you are looking for.
            active_before: integer (unix time) - Only include contacts
                included in at least one email dated before a given time. This
                parameter should be a standard unix timestamp
            active_after: integer (unix time) - Only include contacts included
                in at least one email dated after a given time. This parameter
                should be a standard unix timestamp
            sort_by: string - The field by which to sort the returned results.
                Possible values are email, count, received_count and sent_count
            sort_order: string - The sort order of the returned results.
                Possible values are asc and desc
            limit: integer - The maximum number of results to return.
            offset: integer - Start the list at this offset (zero-based).

        Returns:
            A list of Contact objects
        """
        all_args = [
            'search', 'active_before', 'active_after', 'limit', 'offset',
            'sort_by', 'sort_order'
        ]

        params = helpers.sanitize_params(params, all_args)
        contacts = self._request_uri("contacts", params=params)

        return [Contact(self, obj) for obj in contacts.get('matches')]
Esempio n. 2
0
 def setUp(self):
     self.contact = Contact(Mock(spec=[]), {"email": "*****@*****.**"})