Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GroupTalent service hook

  • Loading branch information...
commit 825035980b68d886248190dbff371192b7915f72 1 parent 791bd99
@ghempton ghempton authored
View
3  .gitignore
@@ -7,4 +7,5 @@ config/services.json
vendor/gems
.bundle
docs/payload_data
-.rvmrc
+.rvmrc
+.project
View
20 docs/group_talent
@@ -0,0 +1,20 @@
+GroupTalent
+=======
+
+GroupTalent is a marketplace and platform for doing freelance work. Integrating it with GitHub lets you communicate progress to project owners. See http://www.grouptalent.com/ for more information.
+
+
+Install Notes
+-------------
+
+ 1. Token - GitHub Service Hook Token for your GroupTalent project. Get it from the project configuration page.
+
+
+Developer Notes
+---------------
+
+data
+ - token
+
+payload
+ - refer to docs/github_payload
View
12 services/group_talent.rb
@@ -0,0 +1,12 @@
+class Service::GroupTalent < Service
+ string :token
+
+ def receive_push
+ res = http_post "https://grouptalent.com/github/receive_push/#{data[:token]}",
+ {'payload' => payload.to_json}
+
+ if res.status != 200
+ raise_config_error
+ end
+ end
+end
View
23 test/group_talent_test.rb
@@ -0,0 +1,23 @@
+require File.expand_path('../helper', __FILE__)
+
+class GroupTalentTest < Service::TestCase
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ end
+
+ def test_push
+ url = "/github/receive_push/abc"
+ @stubs.post url do |env|
+ assert_equal "payload=%22payload%22", env[:body]
+ [200, {}, '']
+ end
+
+ svc = service :push, {:token => 'abc'}, 'payload'
+ svc.receive
+ end
+
+ def service(*args)
+ super Service::GroupTalent, *args
+ end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.