@@ -83,7 +83,7 @@ def user_disable(self, username):
83
83
"""Override the disable method"""
84
84
return self .user_deactivate (username )
85
85
86
- def user_disable_throw_rest_endpoint (self , username , url = '/ rest/scriptrunner/latest/custom/disableUser' ,
86
+ def user_disable_throw_rest_endpoint (self , username , url = 'rest/scriptrunner/latest/custom/disableUser' ,
87
87
param = 'userName' ):
88
88
"""The disable method throw own rest enpoint"""
89
89
url = "{}?{}={}" .format (url , param , username )
@@ -136,9 +136,10 @@ def get_project_versions(self, key, expand=None):
136
136
:param expand: the parameters to expand
137
137
:return:
138
138
"""
139
+ params = {}
139
140
if expand is not None :
140
141
params ["expand" ] = expand
141
- return self .get ('rest/api/2/project/{}/versions' .format (key ))
142
+ return self .get ('rest/api/2/project/{}/versions' .format (key ), params = params )
142
143
143
144
def get_project_versions_paginated (self , key , start = None , limit = None , order_by = None , expand = None ):
144
145
"""
@@ -363,7 +364,43 @@ def tempo_account_get_accounts(self, skip_archived=None, expand=None):
363
364
url = 'rest/tempo-accounts/1/account'
364
365
return self .get (url , params = params )
365
366
366
- def tempo_account_get_all_customers (self , query = None , count_accounts = None ):
367
+ def tempo_account_add_account (self , data = None ):
368
+ """
369
+ Creates Account, adding new Account requires the Manage Accounts Permission.
370
+ :param data: String then it will convert to json
371
+ :return:
372
+ """
373
+ url = 'rest/tempo-accounts/1/account/'
374
+ if data is None :
375
+ return """Please, provide data e.g.
376
+ {name: "12312312321",
377
+ key: "1231231232",
378
+ lead: {name: "gonchik.tsymzhitov"},
379
+ }
380
+ detail info: http://developer.tempo.io/doc/accounts/api/rest/latest/#-700314780
381
+ """
382
+ return self .post (url , data = data )
383
+
384
+ def tempo_account_delete_account_by_id (self , account_id ):
385
+ """
386
+ Delete an Account by id. Caller must have the Manage Account Permission for the Account.
387
+ The Account can not be deleted if it has an AccountLinkBean.
388
+ :param account_id: the id of the Account to be deleted.
389
+ :return:
390
+ """
391
+ url = 'rest/tempo-accounts/1/account/{id}/' .format (id = account_id )
392
+ return self .delete (url )
393
+
394
+ def tempo_account_get_all_account_by_customer_id (self , customer_id ):
395
+ """
396
+ Get un-archived Accounts by customer. The Caller must have the Browse Account permission for the Account.
397
+ :param customer_id: the Customer id.
398
+ :return:
399
+ """
400
+ url = 'rest/tempo-accounts/1/account/customer/{customerId}/' .format (customerId = customer_id )
401
+ return self .get (url )
402
+
403
+ def tempo_account_get_customers (self , query = None , count_accounts = None ):
367
404
"""
368
405
Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer.
369
406
:param query: OPTIONAL: query for search
@@ -378,6 +415,20 @@ def tempo_account_get_all_customers(self, query=None, count_accounts=None):
378
415
url = 'rest/tempo-accounts/1/customer'
379
416
return self .get (url , params = params )
380
417
418
+ def tempo_account_add_customer (self , data = None ):
419
+ """
420
+ Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer.
421
+ :param data:
422
+ :return: if error will show in error log, like validation unsuccessful. If success will good.
423
+ """
424
+ if data is None :
425
+ return """Please, set the data as { isNew:boolean
426
+ name:string
427
+ key:string
428
+ id:number } or you can put only name and key parameters"""
429
+ url = 'rest/tempo-accounts/1/customer'
430
+ return self .post (url , data = data )
431
+
381
432
def tempo_account_get_customer_by_id (self , customer_id = 1 ):
382
433
"""
383
434
Get Account Attribute whose key or name contain a specific substring. Attribute can be a Category or Customer.
@@ -387,11 +438,11 @@ def tempo_account_get_customer_by_id(self, customer_id=1):
387
438
url = 'rest/tempo-accounts/1/customer/{id}' .format (id = customer_id )
388
439
return self .get (url )
389
440
390
- def tempo_account_update_customer_by_id (self , customer_id = 1 , body = None ):
441
+ def tempo_account_update_customer_by_id (self , customer_id = 1 , data = None ):
391
442
"""
392
443
Updates an Attribute. Caller must have Manage Account Permission. Attribute can be a Category or Customer.
393
444
:param customer_id: id of Customer record
394
- :param body : format is
445
+ :param data : format is
395
446
{
396
447
isNew:boolean
397
448
name:string
@@ -400,9 +451,13 @@ def tempo_account_update_customer_by_id(self, customer_id=1, body=None):
400
451
}
401
452
:return: json with parameters name, key and id.
402
453
"""
403
-
454
+ if data is None :
455
+ return """Please, set the data as { isNew:boolean
456
+ name:string
457
+ key:string
458
+ id:number }"""
404
459
url = 'rest/tempo-accounts/1/customer/{id}' .format (id = customer_id )
405
- return self .put (url , data = body )
460
+ return self .put (url , data = data )
406
461
407
462
def tempo_account_delete_customer_by_id (self , customer_id = 1 ):
408
463
"""
0 commit comments