redmine_api_helper 0.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of redmine_api_helper might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +2 -0
  3. data/.gitignore +9 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE +339 -0
  7. data/README.md +30 -0
  8. data/Rakefile +2 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/redmine_api_helper.rb +44 -0
  12. data/lib/redmine_api_helper/api_helper.rb +310 -0
  13. data/lib/redmine_api_helper/args_helper.rb +96 -0
  14. data/lib/redmine_api_helper/attachments_api_helper.rb +52 -0
  15. data/lib/redmine_api_helper/define_api_helpers.rb +78 -0
  16. data/lib/redmine_api_helper/document_categories_api_helper.rb +38 -0
  17. data/lib/redmine_api_helper/groups_api_helper.rb +80 -0
  18. data/lib/redmine_api_helper/helpers.rb +48 -0
  19. data/lib/redmine_api_helper/issue_priorities_api_helper.rb +38 -0
  20. data/lib/redmine_api_helper/issue_relations_api_helper.rb +66 -0
  21. data/lib/redmine_api_helper/issue_statuses_api_helper.rb +36 -0
  22. data/lib/redmine_api_helper/issues_api_helper.rb +124 -0
  23. data/lib/redmine_api_helper/my_account_api_helper.rb +45 -0
  24. data/lib/redmine_api_helper/news_api_helper.rb +73 -0
  25. data/lib/redmine_api_helper/project_memberships_api_helper.rb +77 -0
  26. data/lib/redmine_api_helper/projects_api_helper.rb +73 -0
  27. data/lib/redmine_api_helper/roles_api_helper.rb +52 -0
  28. data/lib/redmine_api_helper/search_api_helper.rb +38 -0
  29. data/lib/redmine_api_helper/time_entries_api_helper.rb +73 -0
  30. data/lib/redmine_api_helper/time_entry_activities_api_helper.rb +38 -0
  31. data/lib/redmine_api_helper/trackers_api_helper.rb +38 -0
  32. data/lib/redmine_api_helper/users_api_helper.rb +73 -0
  33. data/lib/redmine_api_helper/version.rb +24 -0
  34. data/lib/redmine_api_helper/wiki_pages_api_helper.rb +66 -0
  35. data/redmine_api_helper.gemspec +33 -0
  36. metadata +96 -0
@@ -0,0 +1,124 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module IssuesAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads issues_url from args
25
+ ########################################################################################
26
+ def issues_url(**params)
27
+ url_path(args.urls.Home, "issues", params)
28
+ end #def
29
+
30
+ ########################################################################################
31
+ # creates issue_url
32
+ ########################################################################################
33
+ def issue_url(id, **params)
34
+ url_path(issues_url, id, params)
35
+ end #def
36
+
37
+ ########################################################################################
38
+ # reads issues_url from args
39
+ ########################################################################################
40
+ def project_issues_url(project_id, **params)
41
+ url_path(project_url(project_id), 'issues', params)
42
+ end #def
43
+
44
+ ########################################################################################
45
+ # creates project_issue_url
46
+ ########################################################################################
47
+ def project_issue_url(project_id, id, **params)
48
+ url_path(project_issues_url(project_id), id, params)
49
+ end #def
50
+
51
+ ########################################################################################
52
+ # lists issues, corresponds to controller#index
53
+ ########################################################################################
54
+ def list_issues(**params)
55
+ list_objects(:issues, params)
56
+ end #def
57
+
58
+ ########################################################################################
59
+ # lists project issues, corresponds to controller#index
60
+ ########################################################################################
61
+ def list_project_issues(project_id, **params)
62
+ list_project_objects(project_id, :issues, params)
63
+ end #def
64
+
65
+ ########################################################################################
66
+ # reads issue having id, corresponds to controller#show
67
+ ########################################################################################
68
+ def read_issue(id, **params)
69
+ read_object(:issue, id, params)
70
+ end #def
71
+
72
+ ########################################################################################
73
+ # creates a new issue with params, corresponds to controller#create
74
+ ########################################################################################
75
+ def create_issue(**params)
76
+ create_object(:issue, params)
77
+ end #def
78
+
79
+ ########################################################################################
80
+ # updates an existing issue with params, corresponds to controller#update
81
+ ########################################################################################
82
+ def update_issue(id, **params)
83
+ update_object(:issue, id, params)
84
+ end #def
85
+
86
+ ########################################################################################
87
+ # 'bulk_updates' existing issues with params, simulate controller#bulk_update
88
+ ########################################################################################
89
+ def update_issues(ids, **params)
90
+ ids.each do |id|
91
+ update_object(:issue, id, params)
92
+ end
93
+ end #def
94
+
95
+ ########################################################################################
96
+ # deletes an existing issue with params, corresponds to controller#destroy
97
+ ########################################################################################
98
+ def destroy_issue(id, **params)
99
+ destroy_object(:issue, id, params)
100
+ end #def
101
+
102
+ ########################################################################################
103
+ # reads watchers_url from args
104
+ ########################################################################################
105
+ def watchers_url(**params)
106
+ url_path(args.urls.Watch, params)
107
+ end #def
108
+
109
+ ########################################################################################
110
+ # creates a watcher with params, corresponds to watchers#create: params: user_id
111
+ ########################################################################################
112
+ def create_issue_watcher(issue_id, user_id, **params)
113
+ jpost(params.merge(:object_type => 'issue', :object_id => issue_id, :user_id => user_id), :url => watchers_url )
114
+ end #def
115
+
116
+ ########################################################################################
117
+ # deletes a watcher with params, corresponds to watchers#destroy
118
+ ########################################################################################
119
+ def destroy_issue_watcher(issue_id, user_id, **params)
120
+ jdel(:url => watchers_url, :params => params.merge(:object_type => 'issue', :object_id => issue_id, :user_id => user_id))
121
+ end #def
122
+
123
+ end #module
124
+ end #module
@@ -0,0 +1,45 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module MyAccountAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads my_account_url from args
25
+ ########################################################################################
26
+ def my_account_url(**params)
27
+ url_path(args.urls.Home, "my", "account", params)
28
+ end #def
29
+
30
+ ########################################################################################
31
+ # reads my account, corresponds to controller#show
32
+ ########################################################################################
33
+ def read_my_account(**params)
34
+ jget(params.merge(:url => my_account_url)).user
35
+ end #def
36
+
37
+ ########################################################################################
38
+ # updates my account with params, corresponds to controller#update
39
+ ########################################################################################
40
+ def update_my_account(**params)
41
+ jput({:user => params}, :url => my_account_url)
42
+ end #def
43
+
44
+ end #module
45
+ end #module
@@ -0,0 +1,73 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module NewsAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads news_url from args
25
+ ########################################################################################
26
+ def news_index_url(**params)
27
+ url_path(args.urls.Home, "news", params)
28
+ end #def
29
+
30
+ ########################################################################################
31
+ # creates new_url
32
+ ########################################################################################
33
+ def news_url(id, **params)
34
+ url_path(news_index_url, id, params)
35
+ end #def
36
+
37
+ ########################################################################################
38
+ # reads project_news_url from args
39
+ ########################################################################################
40
+ def project_news_index_url(project_id, **params)
41
+ url_path(project_url(project_id), "news", params)
42
+ end #def
43
+
44
+ ########################################################################################
45
+ # creates project_new_url
46
+ ########################################################################################
47
+ def project_news_url(project_id, id, **params)
48
+ url_path(project_news_index_url(project_id), id, params)
49
+ end #def
50
+
51
+ ########################################################################################
52
+ # list_news result, corresponds to controller#index
53
+ ########################################################################################
54
+ def list_news(**params)
55
+ jget(:url => news_index_url, :params => params ).news
56
+ end #def
57
+
58
+ ########################################################################################
59
+ # list_news result, corresponds to controller#index
60
+ ########################################################################################
61
+ def list_project_news(project_id, **params)
62
+ jget(:url => project_news_index_url(project_id), :params => params ).news
63
+ end #def
64
+
65
+ ########################################################################################
66
+ # read_news result, corresponds to controller#show
67
+ ########################################################################################
68
+ def read_news(id, **params)
69
+ read_object(:news, id, params)
70
+ end #def
71
+
72
+ end #module
73
+ end #module
@@ -0,0 +1,77 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module ProjectMembershipsAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads projects_url from args
25
+ ########################################################################################
26
+ def project_memberships_url(project_id, **params)
27
+ url_path(project_url(project_id), "memberships", params)
28
+ end #def
29
+
30
+ def memberships_url(**params)
31
+ url_path(args.urls.Home, "memberships", params)
32
+ end #def
33
+
34
+ ########################################################################################
35
+ # creates a membership_url
36
+ ########################################################################################
37
+ def membership_url(id, **params)
38
+ url_path(memberships_url, id, params)
39
+ end #def
40
+
41
+ ########################################################################################
42
+ # lists projects, corresponds to controller#index
43
+ ########################################################################################
44
+ def list_project_memberships(project_id, **params)
45
+ list_project_objects(project_id, :memberships, params)
46
+ end #def
47
+
48
+ ########################################################################################
49
+ # reads project having id, corresponds to controller#show
50
+ ########################################################################################
51
+ def read_membership(id, **params)
52
+ read_object(:membership, id, params)
53
+ end #def
54
+
55
+ ########################################################################################
56
+ # creates a new project with params, corresponds to controller#create
57
+ ########################################################################################
58
+ def create_project_membership(project_id, **params)
59
+ create_project_object(project_id, :membership, params)
60
+ end #def
61
+
62
+ ########################################################################################
63
+ # updates an existing project with params, corresponds to controller#update
64
+ ########################################################################################
65
+ def update_membership(id, **params)
66
+ update_object(:membership, id, params)
67
+ end #def
68
+
69
+ ########################################################################################
70
+ # deletes an existing project with params, corresponds to controller#destroy
71
+ ########################################################################################
72
+ def destroy_membership(id, **params)
73
+ destroy_object(:membership, id, params)
74
+ end #def
75
+
76
+ end #module
77
+ end #module
@@ -0,0 +1,73 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module ProjectsAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads projects_url from args
25
+ ########################################################################################
26
+ def projects_url(**params)
27
+ url_path(args.urls.Home, "projects", params)
28
+ end #def
29
+
30
+ ########################################################################################
31
+ # creates project_url
32
+ ########################################################################################
33
+ def project_url(id, **params)
34
+ url_path(projects_url, id, params)
35
+ end #def
36
+
37
+ ########################################################################################
38
+ # lists projects, corresponds to controller#index
39
+ ########################################################################################
40
+ def list_projects(**params)
41
+ list_objects(:projects, params)
42
+ end #def
43
+
44
+ ########################################################################################
45
+ # reads project having id, corresponds to controller#show
46
+ ########################################################################################
47
+ def read_project(id, **params)
48
+ read_object(:project, id, params)
49
+ end #def
50
+
51
+ ########################################################################################
52
+ # creates a new project with params, corresponds to controller#create
53
+ ########################################################################################
54
+ def create_project(**params)
55
+ create_object(:project, params)
56
+ end #def
57
+
58
+ ########################################################################################
59
+ # updates an existing project with params, corresponds to controller#update
60
+ ########################################################################################
61
+ def update_project(id, **params)
62
+ update_object(:project, id, params)
63
+ end #def
64
+
65
+ ########################################################################################
66
+ # deletes an existing project with params, corresponds to controller#destroy
67
+ ########################################################################################
68
+ def destroy_project(id, **params)
69
+ destroy_object(:project, id, params)
70
+ end #def
71
+
72
+ end #module
73
+ end #module
@@ -0,0 +1,52 @@
1
+ ##
2
+ # aids creating fiddles for redmine_scripting_engine
3
+ #
4
+ # Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; either version 2
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
+ #
20
+ module RedmineAPIHelper
21
+ module RolesAPIHelper
22
+
23
+ ########################################################################################
24
+ # reads roles_url from args
25
+ ########################################################################################
26
+ def roles_url(**params)
27
+ url_path(args.urls.Home, "roles", params)
28
+ end #def
29
+
30
+ ########################################################################################
31
+ # creates a role_url
32
+ ########################################################################################
33
+ def role_url(id, **params)
34
+ url_path(roles_url, id, params)
35
+ end #def
36
+
37
+ ########################################################################################
38
+ # lists roles, corresponds to controller#index
39
+ ########################################################################################
40
+ def list_roles(**params)
41
+ list_objects(:roles, params)
42
+ end #def
43
+
44
+ ########################################################################################
45
+ # read role, corresponds to controller#show
46
+ ########################################################################################
47
+ def read_role(id, **params)
48
+ read_object(:role, id, params)
49
+ end #def
50
+
51
+ end #module
52
+ end #module