Ejemplo n.º 1
0
    def put_team_task(self,
                      company_id,
                      team_id,
                      code,
                      description,
                      url,
                      engagements=None,
                      all_in_company=None):
        """
        Update an activity within a team.

        The authenticated user needs to have hiring manager privileges.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.


          :code:          Task code

          :description:   Task description

          :url:           Task URL

          :engagements:   (optional) A list of engagements
                          that are to be assigned to the created activity.
                          It can be a single engagement ID,
                          or an iterable of IDs.

          :all_in_company:  (optional) If ``True``, assign the
                            updated activity to all engagements
                            that are exist in the company at
                            the moment.

          If both ``engagements`` and ``all_in_company`` are provided,
          ``engagements`` list will override the ``all_in_company`` setting.

        """
        put_url = 'tasks/companies/{0}/teams/{1}/tasks/{2}'.format(
            company_id, team_id, quote(str(code)))
        data = {'code': code, 'description': description, 'url': url}

        if engagements:
            engagements = self._encode_task_codes(engagements)
            data['engagements'] = engagements

        if all_in_company:
            data['all_in_company'] = 1

        result = self.put(put_url, data)
        return result
Ejemplo n.º 2
0
    def put_team_task(self, company_id, team_id, code, description, url,
                      engagements=None, all_in_company=None):
        """
        Update an activity within a team.

        The authenticated user needs to have hiring manager privileges.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.


          :code:          Task code

          :description:   Task description

          :url:           Task URL

          :engagements:   (optional) A list of engagements
                          that are to be assigned to the created activity.
                          It can be a single engagement ID,
                          or an iterable of IDs.

          :all_in_company:  (optional) If ``True``, assign the
                            updated activity to all engagements
                            that are exist in the company at
                            the moment.

          If both ``engagements`` and ``all_in_company`` are provided,
          ``engagements`` list will override the ``all_in_company`` setting.

        """
        put_url = 'tasks/companies/{0}/teams/{1}/tasks/{2}'.format(
            company_id, team_id, quote(str(code)))
        data = {'code': code,
                'description': description,
                'url': url}

        if engagements:
            engagements = self._encode_task_codes(engagements)
            data['engagements'] = engagements

        if all_in_company:
            data['all_in_company'] = 1

        result = self.put(put_url, data)
        return result
Ejemplo n.º 3
0
    def get_provider(self, provider_ciphertext):
        """
        Retrieve an exhaustive list of attributes associated with the \
        referenced provider.

        *Parameters:*
          :provider_ciphertext:   The provider's cipher text (key)

        """
        if isinstance(provider_ciphertext, (list, tuple)):
            provider_ciphertext = map(str, provider_ciphertext)
            provider_ciphertext = quote(';').join(provider_ciphertext[:20])

        url = 'providers/{0}'.format(provider_ciphertext)
        result = self.get(url)
        return result.get('profile', result)
Ejemplo n.º 4
0
    def unarchive_team_task(self, company_id, team_id, task_code):
        """Unarchive single activity within a team.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.

          :task_code:     A single Activity ID as a string
                          or a list or tuple of IDs.

        """
        task_code = self._encode_task_codes(task_code)

        url = 'tasks/companies/{0}/teams/{1}/unarchive/{2}'.format(
            company_id, team_id, quote(task_code))
        return self.put(url, data={})
Ejemplo n.º 5
0
    def unarchive_team_task(self, company_id, team_id, task_code):
        """Unarchive single activity within a team.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.

          :task_code:     A single Activity ID as a string
                          or a list or tuple of IDs.

        """
        task_code = self._encode_task_codes(task_code)

        url = 'tasks/companies/{0}/teams/{1}/unarchive/{2}'.format(
            company_id, team_id, quote(task_code))
        return self.put(url, data={})
Ejemplo n.º 6
0
    def get_team_specific_tasks(self, company_id, team_id, task_codes):
        """
        Return a specific activities within a team.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.

          :task_codes:    Task codes (must be a list, even of 1 item)

        """
        task_codes = self._encode_task_codes(task_codes)
        url = 'tasks/companies/{0}/teams/{1}/tasks/{2}'.format(
            company_id, team_id, quote(task_codes))
        result = self.get(url)
        try:
            return result["tasks"] or []
        except KeyError:
            return result
Ejemplo n.º 7
0
    def get_team_specific_tasks(self, company_id, team_id, task_codes):
        """
        Return a specific activities within a team.

        *Parameters:*
          :company_id:    Company ID. Use the ``parent_team__id`` value
                          from ``hr.get_team()`` API call.

          :team_id:       Team ID. Use the 'id' value
                          from ``hr.get_team()`` API call.

          :task_codes:    Task codes (must be a list, even of 1 item)

        """
        task_codes = self._encode_task_codes(task_codes)
        url = 'tasks/companies/{0}/teams/{1}/tasks/{2}'.format(
            company_id, team_id, quote(task_codes))
        result = self.get(url)
        try:
            return result["tasks"] or []
        except KeyError:
            return result