Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/skydeskprojects
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SkyDesk Projects Requirements:

Log into the SkyDesk portal first.
SkyDesk Portal URL : https://www.skydesk.jp
Then access SkyDesk projects using https://projects.skydesk.jp.

Project ID and Token is required for configuration which will be available under "Dashboard" --> "Project Settings" --> "Service Hooks".

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.

Syntax: `OPEN SQUARE BRACKET #BUGID CLOSE SQUARE BRACKET` followed by commit message

Ex: `[#SDP-23] fixed the memory leak issue.`

This will associate the changeset with bug with ID SDP-23.

For more than one bugs, provide the BUG IDS separated by comma.

Ex: `[#SDP-24,#SDP-25] UI alignment fix done.`
30 changes: 30 additions & 0 deletions lib/services/skydeskprojects.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# encoding: utf-8
class Service::SkyDeskProjects < Service::HttpPost
string :project_id, :token

white_list :project_id

url "https://www.skydesk.jp"
logo_url "https://www.skydesk.jp/static/common/images/header/ci/ci_skydesk.gif"

maintained_by :github => 'SkyDeskProjects'

supported_by :web => 'www.skydesk.jp/en/contact/',
:email => 'support_projects@skydesk.jp'

def receive_push
token = required_config_value('token')
pId = required_config_value('project_id')
#http.headers['Authorization'] = "Token #{token}"

#url = "https://projects.skydesk.jp/serviceHook"
res = http_post "https://projects.skydesk.jp/serviceHook",
:pId => pId,
:authtoken => token,
:scope => "projectsapi",
:payload => generate_json(payload)
if res.status != 200
raise_config_error
end
end
end
30 changes: 30 additions & 0 deletions test/skydeskprojects_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require File.expand_path('../helper', __FILE__)

class SkyDeskProjectsTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
end

def test_push
url = "/serviceHook"
data = {
"project_id" => "1234",
"token" => "a13d",
}
svc = service(data, payload)
@stubs.post url do |env|
assert_equal 'projects.skydesk.jp', env[:url].host
params = Faraday::Utils.parse_query(env[:body])
assert_equal '1234', params['pId']
assert_equal 'a13d', params['authtoken']
assert_equal payload, JSON.parse(params['payload'])
[200, {}, '']

end
svc.receive
end

def service(*args)
super Service::SkyDeskProjects, *args
end
end