Permalink
Browse files

GroupTalent service hook

  • Loading branch information...
1 parent 791bd99 commit 825035980b68d886248190dbff371192b7915f72 @ghempton ghempton committed Apr 4, 2012
Showing with 57 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +20 −0 docs/group_talent
  3. +12 −0 services/group_talent.rb
  4. +23 −0 test/group_talent_test.rb
View
@@ -7,4 +7,5 @@ config/services.json
vendor/gems
.bundle
docs/payload_data
-.rvmrc
+.rvmrc
+.project
View
@@ -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
@@ -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
@@ -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
+

0 comments on commit 8250359

Please sign in to comment.