'Rank an issue before another using the default Ranking field, the one named \'Rank\'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue.'

def rank(self, issue, next_issue):

    if (not self._rank):
        for field in self.fields():
            if (field[u'name'] == u'Rank'):
                if (field[u'schema'][u'custom'] == u'com.pyxis.greenhopper.jira:gh-lexo-rank'):
                    self._rank = field[u'schema'][u'customId']
                    break
                elif (field[u'schema'][u'custom'] == u'com.pyxis.greenhopper.jira:gh-global-rank'):
                    self._rank = field[u'schema'][u'customId']
    if (self._options[u'agile_rest_path'] == GreenHopperResource.AGILE_BASE_REST_PATH):
        url = self._get_url(u'issue/rank', base=self.AGILE_BASE_URL)
        payload = {u'issues': [issue], u'rankBeforeIssue': next_issue, u'rankCustomFieldId': self._rank}
        try:
            return self._session.put(url, data=json.dumps(payload))
        except JIRAError as e:
            if (e.status_code == 404):
                warnings.warn(u'Status    code    404    may    mean,    that    too    old    JIRA    Agile    version    is    installed.    At    least    version    6.7.10    is    required.')
            raise
    elif (self._options[u'agile_rest_path'] == GreenHopperResource.GREENHOPPER_REST_PATH):
        data = {u'issueKeys': [issue], u'rankBeforeKey': next_issue, u'customFieldId': self._rank}
        url = self._get_url(u'rank', base=self.AGILE_BASE_URL)
        return self._session.put(url, data=json.dumps(data))
    else:
        raise NotImplementedError((u'No    API    for    ranking    issues    for    agile_rest_path="%s"' % self._options[u'agile_rest_path']))
