Deal Category¶
Requires Pro Edition and CRM plugin >= 3.3.0.
Manager¶
All operations on the DealCategory resource are provided by its manager. To get access to
it you have to call redmine.deal_category
where redmine
is a configured redmine object.
See the Configuration about how to configure redmine object.
Create methods¶
Added in version 2.5.0.
create¶
- redminelib.managers.ResourceManager.create(**fields)
Creates new DealCategory resource with given fields and saves it to the CRM plugin.
- Parameters:
project_id (int or string) – (required). Id or identifier of deal category’s project.
name (string) – (required). Category name.
- Returns:
Resource object
>>> category = redmine.deal_category.create(project_id='vacation', name='Integration')
>>> category
<redminelib.resources.DealCategory #123>
new¶
- redminelib.managers.ResourceManager.new()
Creates new empty DealCategory resource, but saves it to the CRM plugin only when
save()
is called, also callspre_create()
andpost_create()
methods of the Resource object. Valid attributes are the same as forcreate()
method above.- Returns:
Resource object
>>> category = redmine.deal_category.new()
>>> category.project_id = 'vacation'
>>> category.name = 'Integration'
>>> category.save()
<redminelib.resources.DealCategory #123>
Read methods¶
get¶
Added in version 2.1.0.
- redminelib.managers.ResourceManager.get(resource_id, **params)
Returns single DealCategory resource from the CRM plugin by its id.
- Parameters:
resource_id (int) – (required). Id of the deal category.
project_id (int or string) – (required). Id or identifier of deal category’s project.
- Returns:
Resource object
>>> category = redmine.deal_category.get(1, project_id='vacation')
>>> category
<redminelib.resources.DealCategory #1 "Design">
all¶
Not supported by CRM plugin
filter¶
- redminelib.managers.ResourceManager.filter(**filters)
Returns DealCategory resources that match the given lookup parameters.
- Parameters:
project_id (int or string) – (required). Id or identifier of deal category’s project.
limit (int) – (optional). How much resources to return.
offset (int) – (optional). Starting from what resource to return the other resources.
- Returns:
ResourceSet object
>>> categories = redmine.deal_category.filter(project_id='vacation')
>>> categories
<redminelib.resultsets.ResourceSet object with DealCategory resources>
Hint
You can also get deal categories from a Project resource object directly using
deal_categories
relation:
>>> project = redmine.project.get('vacation')
>>> project.deal_categories
<redminelib.resultsets.ResourceSet object with DealCategory resources>
Update methods¶
Added in version 2.5.0.
update¶
- redminelib.managers.ResourceManager.update(resource_id, **fields)
Updates values of given fields of a DealCategory resource and saves them to the CRM plugin.
- Parameters:
resource_id (int) – (required). Category id.
name (string) – (required). Category name.
- Returns:
True
>>> redmine.deal_category.update(123, name='Software')
True
save¶
- redminelib.resources.DealCategory.save(**attrs)
Saves the current state of a DealCategory resource to the CRM plugin. Attrs that can be changed are the same as for
update()
method above.- Returns:
Resource object
>>> category = redmine.deal_category.get(123)
>>> category.name = 'Software'
>>> category.save()
<redminelib.resources.DealCategory #123>
Added in version 2.1.0: Alternative syntax was introduced.
>>> category = redmine.deal_category.get(123).save(name='Software')
>>> category
<redminelib.resources.DealCategory #123>
Delete methods¶
Added in version 2.5.0.
delete¶
- redminelib.managers.ResourceManager.delete(resource_id)
Deletes single DealCategory resource from the CRM plugin by its id.
- Parameters:
resource_id (int) – (required). Category id.
- Returns:
True
>>> redmine.deal_category.delete(123)
True
- redminelib.resources.DealCategory.delete()
Deletes current DealCategory resource object from the CRM plugin.
- Returns:
True
>>> category = redmine.deal_category.get(1)
>>> category.delete()
True
Export¶
Not supported by CRM plugin