コード例 #1
0
ファイル: ac.py プロジェクト: jaymzcd/phenny
def ac(phenny, input): 
    """
        Makes a request to an Active Collab install. Needs pyacollab to
        work. 
    """
    ac_filter = input.group(2).split(' ')
    filter_name = ac_filter[0]
    if str.isdigit(str(filter_name)):
        # Assume that we're referencing a project id
        item_id = ac_filter[0]
    else:
        item_id = None

    def _param(num):
        try:
            return ac_filter[num]
        except IndexError:
            return None
        
    subcommand, sub_id = [_param(x) for x in range(1, 3)]
    req = ACRequest('projects', item_id=item_id, subcommand=subcommand, sub_id=sub_id)
    ac_response = req.execute()

    for item in ac_response:
        # If we have an id then print out all the returned data
        if str.isdigit(str(filter_name)):
            phenny.say(item)
        else:
            # Otherwise we're filtering on the project names
            if filter_name in item.lower():
                phenny.say(item)
コード例 #2
0
ファイル: activecollab.py プロジェクト: NaszvadiG/qtimer
	def postTimer(self, projectId=-1, ticketId=-1, data=None):
		if (projectId == -1):
			raise PluginError('Invalid project id')

		if (ticketId == -1):
			raise PluginError('Invalid ticket id')

		req = ACRequest('projects', item_id=projectId, subcommand='time/add',
			data=data, ac_url=self.url, api_key=self.token)
		return req.execute()
コード例 #3
0
ファイル: activecollab.py プロジェクト: NaszvadiG/qtimer
	def listTickets(self, projectId=-1):
		if (projectId == -1):
			raise PluginError('Invalid project id')

		req = ACRequest('projects', item_id=projectId, subcommand='tickets',
			ac_url=self.url, api_key=self.token)

		makeTicket = lambda item: Ticket(id=item['id'], name=item['name'],
			ticket_id=item['ticket_id'], project_id=projectId)

		return [ makeTicket(item) for item in req.execute() ]
コード例 #4
0
    def postTimer(self, projectId=-1, ticketId=-1, data=None):
        if (projectId == -1):
            raise PluginError('Invalid project id')

        if (ticketId == -1):
            raise PluginError('Invalid ticket id')

        req = ACRequest('projects',
                        item_id=projectId,
                        subcommand='time/add',
                        data=data,
                        ac_url=self.url,
                        api_key=self.token)
        return req.execute()
コード例 #5
0
    def listTickets(self, projectId=-1):
        if (projectId == -1):
            raise PluginError('Invalid project id')

        req = ACRequest('projects',
                        item_id=projectId,
                        subcommand='tickets',
                        ac_url=self.url,
                        api_key=self.token)

        makeTicket = lambda item: Ticket(id=item['id'],
                                         name=item['name'],
                                         ticket_id=item['ticket_id'],
                                         project_id=projectId)

        return [makeTicket(item) for item in req.execute()]
コード例 #6
0
ファイル: demo.py プロジェクト: berkona/pyacollab
from activecollab.library import ACRequest
from sys import argv

try:
    item_id = argv[1]
except IndexError:
    item_id = None

try:
    subcommand = argv[2]
except IndexError:
    subcommand = None

try:
    sub_id = argv[3]
except IndexError:
    sub_id = None


req = ACRequest('projects', item_id=item_id, subcommand=subcommand, sub_id=sub_id)
print req.command_url
req.execute()

コード例 #7
0
    def listProjects(self):
        req = ACRequest('projects', ac_url=self.url, api_key=self.token)

        makeProject = lambda item: Project(id=item['id'], name=item['name'])
        return filter(makeProject, req.execute())
コード例 #8
0
ファイル: activecollab.py プロジェクト: NaszvadiG/qtimer
	def listProjects(self):
		req = ACRequest('projects', ac_url=self.url,
			api_key=self.token)

		makeProject = lambda item: Project(id=item['id'], name=item['name'])
		return filter(makeProject, req.execute())