@@ -3,36 +3,44 @@ class Service::Kanbanize < Service
33 string :kanbanize_api_key
44 string :restrict_to_branch
55 boolean :restrict_to_last_commit
6+ boolean :track_project_issues_in_kanbanize
7+ string :project_issues_board_id
68
79 # Skip the api key from the debug logs.
8- white_list :kanbanize_domain_name , :restrict_to_branch , :restrict_to_last_comment
10+ white_list :kanbanize_domain_name , :restrict_to_branch , :restrict_to_last_comment , :track_project_issues_in_kanbanize , :project_issues_board_id
11+
12+ default_events :push , :issues , :issue_comment
913
1014 url "https://kanbanize.com/"
1115 logo_url "https://kanbanize.com/application/resources/images/logo.png"
1216
1317 maintained_by :github => 'DanielDraganov'
1418 supported_by :email => '[email protected] ' 1519
16- def receive_push
20+ def receive_event
1721 # Make sure that the api key is provided.
1822 raise_config_error "Missing 'kanbanize_api_key'" if data [ 'kanbanize_api_key' ] . to_s == ''
19-
23+
2024 domain_name = data [ 'kanbanize_domain_name' ]
2125 api_key = data [ 'kanbanize_api_key' ]
2226 branch_restriction = data [ 'restrict_to_branch' ] . to_s
2327 commit_restriction = config_boolean_true? ( 'restrict_to_last_commit' )
24-
28+ issues_tracking = config_boolean_true? ( 'track_project_issues_in_kanbanize' )
29+ issues_board_id = data [ 'project_issues_board_id' ] . to_s
30+
2531 # check the branch restriction is poplulated and branch is not included
2632 branch = payload [ 'ref' ] . split ( '/' ) . last
2733 if branch_restriction . length > 0 && branch_restriction . index ( branch ) == nil
2834 return
2935 end
3036
31- http_post "http://#{ domain_name } /index.php/api/kanbanize/git_hub_event" ,
37+ http_post "http://#{ domain_name } /index.php/api/kanbanize/git_hub_event" ,
3238 generate_json ( payload ) ,
3339 'apikey' => api_key ,
3440 'branch-filter' => branch_restriction ,
3541 'last-commit' => commit_restriction ,
42+ 'track-issues' => issues_tracking ,
43+ 'board-id' => issues_board_id ,
3644 'Content-Type' => 'application/json'
3745 end
3846end
0 commit comments