Generic method to return a generator with the results returned from Bamboo. It is intended to work for
        responses in the form:
        {
            'results':
            {
                'size': 5,
                'start-index': 0,
                'max-result': 5,
                'result': []
            },
            ...
        }
        In this case we would have elements_key='results' element_key='result'.
        The only reason to use this generator is to abstract dealing with response pagination from the client

        :param path: URI for the resource
        :return: generator with the contents of response[elements_key][element_key]

def _get_generator(self, path, elements_key='results', element_key='result', data=None, flags=None,
                       params=None, headers=None):
        """
        Generic method to return a generator with the results returned from Bamboo. It is intended to work for
        responses in the form:
        {
            'results':
            {
                'size': 5,
                'start-index': 0,
                'max-result': 5,
                'result': []
            },
            ...
        }
        In this case we would have elements_key='results' element_key='result'.
        The only reason to use this generator is to abstract dealing with response pagination from the client

        :param path: URI for the resource
        :return: generator with the contents of response[elements_key][element_key]
        """
        size = 1
        start_index = 0
        while size:
            params['start-index'] = start_index
            response = self.get(path, data, flags, params, headers)
            results = response[elements_key]
            size = results['size']
            # Check if start index was reset when reaching the end of the pages list
            if results['start-index'] < start_index:
                break
            for r in results[element_key]:
                yield r
            start_index += results['max-result']