public
Description: Sinatra app that pushes your Github Commit info to twitter
Homepage: http://groups.google.com/group/github-twitter/
Clone URL: git://github.com/jnunemaker/github-twitter.git
Search Repo:
github-twitter / github-twitter-test.rb
100644 40 lines (38 sloc) 1.217 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'net/http'
 
payload = %Q{{
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
"repository": {
"url": "http://github.com/defunkt/github",
"name": "github",
"owner": {
"email": "chris@ozmm.org",
"name": "defunkt"
}
},
"commits": {
"41a212ee83ca127e3c8cf465891ab7216a705f59": {
"url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
"author": {
"email": "chris@ozmm.org",
"name": "Chris Wanstrath"
},
"message": "okay i give in",
"timestamp": "2008-02-15T14:57:17-08:00"
},
"de8251ff97ee194a289832576287d6f8ad74e3d0": {
"url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
"author": {
"email": "chris@ozmm.org",
"name": "Chris Wanstrath"
},
"message": "update pricing a tad",
"timestamp": "2008-02-15T14:36:34-08:00"
}
},
"after": "de8251ff97ee194a289832576287d6f8ad74e3d0"
}}
 
url = URI.parse('http://localhost:4567/')
req = Net::HTTP::Post.new(url.path)
req.set_form_data({'payload' => payload})
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
puts res