Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.

Commit 45a0e52

Browse files
committed
Merge pull request #732 from SkyDeskProjects/master
Request for GitHub integration with SkyDesk Projects. Merge PR #474.
2 parents 8d7ffe6 + a579bb6 commit 45a0e52

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

docs/skydeskprojects

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
SkyDesk Projects Requirements:
2+
3+
Log into the SkyDesk portal first.
4+
SkyDesk Portal URL : https://www.skydesk.jp
5+
Then access SkyDesk projects using https://projects.skydesk.jp.
6+
7+
Project ID and Token is required for configuration which will be available under "Dashboard" --> "Project Settings" --> "Service Hooks".
8+
9+
This service hook allows you to associate changeset(s) with bug(s) in SkyDesk Projects. To associate changeset(s) with bug(s) in SkyDeskProjects you will need to give the BUG ID in in your commit message.
10+
11+
Syntax: `OPEN SQUARE BRACKET #BUGID CLOSE SQUARE BRACKET` followed by commit message
12+
13+
Ex: `[#SDP-23] fixed the memory leak issue.`
14+
15+
This will associate the changeset with bug with ID SDP-23.
16+
17+
For more than one bugs, provide the BUG IDS separated by comma.
18+
19+
Ex: `[#SDP-24,#SDP-25] UI alignment fix done.`

lib/services/skydeskprojects.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# encoding: utf-8
2+
class Service::SkyDeskProjects < Service::HttpPost
3+
string :project_id, :token
4+
5+
white_list :project_id
6+
7+
url "https://www.skydesk.jp"
8+
logo_url "https://www.skydesk.jp/static/common/images/header/ci/ci_skydesk.gif"
9+
10+
maintained_by :github => 'SkyDeskProjects'
11+
12+
supported_by :web => 'www.skydesk.jp/en/contact/',
13+
:email => '[email protected]'
14+
15+
def receive_push
16+
token = required_config_value('token')
17+
pId = required_config_value('project_id')
18+
#http.headers['Authorization'] = "Token #{token}"
19+
20+
#url = "https://projects.skydesk.jp/serviceHook"
21+
res = http_post "https://projects.skydesk.jp/serviceHook",
22+
:pId => pId,
23+
:authtoken => token,
24+
:scope => "projectsapi",
25+
:payload => generate_json(payload)
26+
if res.status != 200
27+
raise_config_error
28+
end
29+
end
30+
end

test/skydeskprojects_test.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require File.expand_path('../helper', __FILE__)
2+
3+
class SkyDeskProjectsTest < Service::TestCase
4+
def setup
5+
@stubs = Faraday::Adapter::Test::Stubs.new
6+
end
7+
8+
def test_push
9+
url = "/serviceHook"
10+
data = {
11+
"project_id" => "1234",
12+
"token" => "a13d",
13+
}
14+
svc = service(data, payload)
15+
@stubs.post url do |env|
16+
assert_equal 'projects.skydesk.jp', env[:url].host
17+
params = Faraday::Utils.parse_query(env[:body])
18+
assert_equal '1234', params['pId']
19+
assert_equal 'a13d', params['authtoken']
20+
assert_equal payload, JSON.parse(params['payload'])
21+
[200, {}, '']
22+
23+
end
24+
svc.receive
25+
end
26+
27+
def service(*args)
28+
super Service::SkyDeskProjects, *args
29+
end
30+
end

0 commit comments

Comments
 (0)