Skip to content

Commit 1117ff4

Browse files
committed
major docs update
1 parent c578de8 commit 1117ff4

20 files changed

+1332
-560
lines changed

docs/changelog.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
Changelog
22
=========
33

4-
0.3.2 (2014-0X-XX)
4+
0.4.0 (2014-02-XX)
55
------------------
66

77
- Added: New exceptions:
88

99
* ConflictError
1010
* ReadonlyAttrError
1111

12+
- Added: Update functionality via update() and save() methods for resources (see docs
13+
for details):
14+
15+
* WikiPage
16+
* Project
17+
18+
- Added: Allow to create resources in alternative way via new() method (see docs for
19+
details)
20+
- Added: Allow daterange TimeEntry resource filtering via ``from_date`` and ``to_date``
21+
keyword arguments (thanks to `Antoni Aloy <https://github.com/aaloy>`_)
22+
- Fixed: `Issue #2 <https://github.com/maxtepkeev/python-redmine/issues/2>`_ (limit/offset
23+
as keyword arguments were broken)
24+
- Changed: Documentation for resources rewritten from scratch to be more understandable
25+
1226
0.3.1 (2014-01-23)
1327
------------------
1428

@@ -20,7 +34,7 @@ Changelog
2034
0.3.0 (2014-01-18)
2135
------------------
2236

23-
- Added: Delete functionality for resources via delete method (see docs for details):
37+
- Added: Delete functionality via delete() method for resources (see docs for details):
2438

2539
* User
2640
* Group
@@ -48,7 +62,7 @@ Changelog
4862
* ResourceNoFieldsProvidedError
4963
* ResourceNotFoundError
5064

51-
- Added: Create functionality for resources via create method (see docs for details):
65+
- Added: Create functionality via create() method for resources (see docs for details):
5266

5367
* User
5468
* Group

docs/operations.rst

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,53 @@ support the requested operation, an exception will be thrown.
1010
Create
1111
------
1212

13-
Resources can be created via ``create`` method. Each resource supports different keyword
14-
arguments. Unfortunately Redmine doesn't support the creation of some resources via REST
15-
API. You can read more about it in each resource's documentation.
13+
Python Redmine provides 2 create operation methods: ``create`` and ``new``. Unfortunately Redmine
14+
doesn't support the creation of some resources via REST API. You can read more about it in each
15+
resource's documentation.
16+
17+
create
18+
++++++
19+
20+
Creates new resource with given fields and saves it to the Redmine.
1621

1722
.. code-block:: python
1823
1924
>>> project = redmine.project.create(name='Vacation', identifier='vacation', description='foo', homepage='http://foo.bar', is_public=True, parent_id=345, inherit_members=True, custom_field_values={2: 'foobar'})
2025
>>> project
2126
<redmine.resources.Project #123 "Vacation">
2227
28+
new
29+
+++
30+
31+
Creates new empty resource but doesn't save it to the Redmine. This is useful if you want to
32+
set some resource fields later based on some condition(s) and only after that save it to the
33+
Redmine.
34+
35+
.. code-block:: python
36+
37+
>>> project = redmine.project.new()
38+
>>> project.name = 'Vacation'
39+
>>> project.identifier = 'vacation'
40+
>>> project.description = 'foo'
41+
>>> project.is_public = True
42+
>>> project.inherit_members = True
43+
>>> project.save()
44+
True
45+
2346
Read
2447
----
2548

2649
Python Redmine provides 3 read operation methods: ``get``, ``all`` and ``filter``. Each
2750
of this methods support different keyword arguments depending on the resource used and
2851
method called. You can read more about it in each resource's documentation.
2952

30-
Get
53+
get
3154
+++
3255

3356
Returns requested Resource object either by integer ``id`` or by string ``identifier``:
3457

3558
.. code-block:: python
3659
37-
>>> redmine = Redmine('http://demo.redmine.org')
3860
>>> project = redmine.project.get('vacation')
3961
>>> project.name
4062
'Vacation'
@@ -69,26 +91,24 @@ Returns requested Resource object either by integer ``id`` or by string ``identi
6991
7092
redmine.project.get('vacation').refresh()
7193
72-
All
94+
all
7395
+++
7496

7597
Returns a ResourceSet object that contains all the requested Resource objects:
7698

7799
.. code-block:: python
78100
79-
>>> redmine = Redmine('http://demo.redmine.org')
80101
>>> projects = redmine.project.all()
81102
>>> projects
82103
<redmine.resultsets.ResourceSet object with Project resources>
83104
84-
Filter
105+
filter
85106
++++++
86107

87108
Returns a ResourceSet object that contains Resource objects filtered by some condition(s):
88109

89110
.. code-block:: python
90111
91-
>>> redmine = Redmine('http://demo.redmine.org')
92112
>>> issues = redmine.issue.filter(project_id='vacation')
93113
>>> issues
94114
<redmine.resultsets.ResourceSet object with Issue resources>
@@ -143,13 +163,13 @@ Returns a ResourceSet object that contains Resource objects filtered by some con
143163

144164
.. code-block:: python
145165
146-
length = len(redmine.project.all())
166+
len(redmine.project.all())
147167
148168
* **list()**. Force evaluation of a ResourceSet by calling list() on it.
149169

150170
.. code-block:: python
151171
152-
projects = list(redmine.project.all())
172+
list(redmine.project.all())
153173
154174
* **Index**. A ResourceSet is also evaluated when you request some of it's Resources by index.
155175

@@ -171,7 +191,7 @@ of some resources via REST API. You can read more about it in each resource's do
171191
.. code-block:: python
172192
173193
>>> redmine.project.delete(1)
174-
>>> True
194+
True
175195
176196
.. warning::
177197

docs/resources/attachment.rst

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,55 @@ Attachment
33

44
Supported by Redmine starting from version 1.3
55

6-
Create
7-
------
6+
Manager
7+
-------
88

9-
Not supported by Redmine. Some resources support adding attachments via it's create/update methods, e.g. issue.
9+
All operations on the attachment resource are provided via it's manager. To get access to it
10+
you have to call ``redmine.attachment`` where ``redmine`` is a configured redmine object.
11+
See the :doc:`../configuration` about how to configure redmine object.
12+
13+
Create methods
14+
--------------
1015

11-
Read
12-
----
16+
Not supported by Redmine. Some resources support adding attachments via it's create/update methods, e.g. issue.
1317

14-
Methods
15-
~~~~~~~
18+
Read methods
19+
------------
1620

17-
Get
21+
get
1822
+++
1923

20-
Supported keyword arguments: None
24+
.. py:method:: get(resource_id)
25+
:module: redmine.managers.ResourceManager
26+
:noindex:
27+
28+
Returns single attachment resource from the Redmine by it's id.
29+
30+
:param integer resource_id: (required). Id of the attachment.
31+
:return: Attachment resource object
2132

2233
.. code-block:: python
2334
2435
>>> attachment = redmine.attachment.get(76905)
2536
>>> attachment
2637
<redmine.resources.Attachment #76905 "1(a).png">
2738
28-
All
39+
all
2940
+++
3041

3142
Not supported by Redmine
3243

33-
Filter
44+
filter
3445
++++++
3546

3647
Not supported by Redmine
3748

38-
Update
39-
------
49+
Update methods
50+
--------------
4051

4152
Not supported by Redmine
4253

43-
Delete
44-
------
54+
Delete methods
55+
--------------
4556

4657
Not supported by Redmine

docs/resources/custom_field.rst

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,54 @@ Custom Field
33

44
Supported by Redmine starting from version 2.4
55

6-
Create
7-
------
6+
Manager
7+
-------
88

9-
Not supported by Redmine
9+
All operations on the custom field resource are provided via it's manager. To get access to
10+
it you have to call ``redmine.custom_field`` where ``redmine`` is a configured redmine object.
11+
See the :doc:`../configuration` about how to configure redmine object.
12+
13+
Create methods
14+
--------------
1015

11-
Read
12-
----
16+
Not supported by Redmine
1317

14-
Methods
15-
~~~~~~~
18+
Read methods
19+
------------
1620

17-
Get
21+
get
1822
+++
1923

2024
Not supported by Redmine
2125

22-
All
26+
all
2327
+++
2428

25-
Supported keyword arguments: None
29+
.. py:method:: all()
30+
:module: redmine.managers.ResourceManager
31+
:noindex:
32+
33+
Returns all custom field resources from the Redmine.
34+
35+
:return: ResourceSet object
2636

2737
.. code-block:: python
2838
2939
>>> fields = redmine.custom_field.all()
3040
>>> fields
3141
<redmine.resultsets.ResourceSet object with CustomField resources>
3242
33-
Filter
43+
filter
3444
++++++
3545

3646
Not supported by Redmine
3747

38-
Update
39-
------
48+
Update methods
49+
--------------
4050

4151
Not supported by Redmine
4252

43-
Delete
44-
------
53+
Delete methods
54+
--------------
4555

4656
Not supported by Redmine

docs/resources/enumeration.rst

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,62 @@ Enumeration
33

44
Supported by Redmine starting from version 2.2
55

6-
Create
7-
------
6+
Manager
7+
-------
88

9-
Not supported by Redmine
9+
All operations on the enumeration resource are provided via it's manager. To get access to
10+
it you have to call ``redmine.enumeration`` where ``redmine`` is a configured redmine object.
11+
See the :doc:`../configuration` about how to configure redmine object.
12+
13+
Create methods
14+
--------------
1015

11-
Read
12-
----
16+
Not supported by Redmine
1317

14-
Methods
15-
~~~~~~~
18+
Read methods
19+
------------
1620

17-
Get
21+
get
1822
+++
1923

2024
Not supported by Redmine
2125

22-
All
26+
all
2327
+++
2428

2529
Not supported by Redmine
2630

27-
Filter
31+
filter
2832
++++++
2933

30-
Supported keyword arguments: None
34+
.. py:method:: filter(**filters)
35+
:module: redmine.managers.ResourceManager
36+
:noindex:
37+
38+
Returns enumeration resources that match the given lookup parameters.
39+
40+
:param string resource:
41+
.. raw:: html
3142

32-
Supported filters:
43+
(required). Get enumerations for the requested resource. Available resources are:
3344

34-
* **resource**. Get enumerations for the requested resource. Available resources are:
45+
- issue_priorities
46+
- time_entry_activities
3547

36-
- issue_priorities
37-
- time_entry_activities
48+
:return: ResourceSet object
3849

3950
.. code-block:: python
4051
4152
>>> enumerations = redmine.enumeration.filter(resource='time_entry_activities')
4253
>>> enumerations
4354
<redmine.resultsets.ResourceSet object with Enumeration resources>
4455
45-
Update
46-
------
56+
Update methods
57+
--------------
4758

4859
Not supported by Redmine
4960

50-
Delete
51-
------
61+
Delete methods
62+
--------------
5263

5364
Not supported by Redmine

0 commit comments

Comments
 (0)