Skip to content

Commit b4d4974

Browse files
Gonchik TsymzhitovGonchik Tsymzhitov
authored andcommitted
JIRA: Tempo Account and customer methods
1 parent 0fee409 commit b4d4974

File tree

2 files changed

+50
-15
lines changed

2 files changed

+50
-15
lines changed

atlassian/jira.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def tempo_account_get_accounts(self, skip_archived=None, expand=None):
363363
url = 'rest/tempo-accounts/1/account'
364364
return self.get(url, params=params)
365365

366-
def tempo_account_get_customers(self, query=None, count_accounts=None):
366+
def tempo_account_get_all_customers(self, query=None, count_accounts=None):
367367
"""
368368
Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer.
369369
:param query: OPTIONAL: query for search
@@ -377,3 +377,38 @@ def tempo_account_get_customers(self, query=None, count_accounts=None):
377377
params['countAccounts'] = count_accounts
378378
url = 'rest/tempo-accounts/1/customer'
379379
return self.get(url, params=params)
380+
381+
def tempo_account_get_customer_by_id(self, customer_id=1):
382+
"""
383+
Get Account Attribute whose key or name contain a specific substring. Attribute can be a Category or Customer.
384+
:param customer_id: id of Customer record
385+
:return: Customer info
386+
"""
387+
url = 'rest/tempo-accounts/1/customer/{id}'.format(id=customer_id)
388+
return self.get(url)
389+
390+
def tempo_account_update_customer_by_id(self, customer_id=1, body=None):
391+
"""
392+
Updates an Attribute. Caller must have Manage Account Permission. Attribute can be a Category or Customer.
393+
:param customer_id: id of Customer record
394+
:param body: format is
395+
{
396+
isNew:boolean
397+
name:string
398+
key:string
399+
id:number
400+
}
401+
:return: json with parameters name, key and id.
402+
"""
403+
404+
url = 'rest/tempo-accounts/1/customer/{id}'.format(id=customer_id)
405+
return self.put(url, data=body)
406+
407+
def tempo_account_delete_customer_by_id(self, customer_id=1):
408+
"""
409+
Delete an Attribute. Caller must have Manage Account Permission. Attribute can be a Category or Customer.
410+
:param customer_id: id of Customer record
411+
:return: Customer info
412+
"""
413+
url = 'rest/tempo-accounts/1/customer/{id}'.format(id=customer_id)
414+
return self.delete(url)
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# coding: utf8
2-
from atlassian import Jira
3-
from var import config
4-
import logging
5-
6-
jira = Jira(
7-
url='http://localhost:8080',
8-
username='admin',
9-
password='admin')
10-
11-
results = jira.tempo_account_get_customers()
12-
print("Count of Customers" + str(len(results)))
13-
14-
for result in results:
1+
# coding: utf8
2+
from atlassian import Jira
3+
from var import config
4+
import logging
5+
6+
jira = Jira(
7+
url='http://localhost:8080',
8+
username='admin',
9+
password='admin')
10+
11+
results = jira.tempo_account_get_all_customers()
12+
print("Count of Customers " + str(len(results)))
13+
14+
for result in results:
1515
print(result.get('key'), ' ', result.get('name'))

0 commit comments

Comments
 (0)