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

Commit 46cf335

Browse files
committed
added notifo service
1 parent 1acde86 commit 46cf335

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

CONTRIBUTORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Thanks to the following people for making this possible
2222
- Michael Bleigh
2323
- Nick Gerakines
2424
- Noah (ngage)
25+
- Paul Stamatiou
2526
- Sanko Robinson
2627
- Sean O'Brien
2728
- Tekkub Stoutwrithe
@@ -32,4 +33,4 @@ Thanks to the following people for making this possible
3233
- Teng Siong Ong
3334
- Nick Plante
3435
- Pedro Morais
35-
- Anton Mironov
36+
- Anton Mironov

docs/github_payload

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
{
44
"data" => {
5-
"api_token" => "API token",
6-
"room_id" => "Room ID",
7-
"digest" => 1
5+
"username" => "pstamatiou",
6+
"apisecret" => "mysecretgoeshere"
87
},
98

109
"payload" => {

docs/notifo

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Notifo
2+
==========
3+
4+
This service lets your broadcast your commits on Notifo, a mobile notifications platform. Get commit notifications on your iPhone and other mobile devices immediately via PUSH.
5+
6+
Install Notes
7+
-------------
8+
9+
1. Create a user account on Notifo at https://notifo.com/user/register
10+
2. Once logged in, go to http://notifo.com/user/settings and find your API secret
11+
3. Fill out your username and apisecret above.
12+
4. Enjoy.
13+
14+
15+
Developer Notes
16+
---------------
17+
18+
data
19+
- username
20+
- apisecret [As listed on http://notifo.com/user/settings]
21+
22+
payload
23+
- refer to docs/github_payload

services/notifo.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
service :notifo do |data, payload|
2+
3+
repository = payload['repository']['name']
4+
url = URI.parse('https://api.notifo.com/v1/send_notification')
5+
6+
payload['commits'].each do |commit|
7+
req = Net::HTTP::Post.new(url.path)
8+
req.basic_auth(data['username'], data['apisecret'])
9+
req.set_form_data(
10+
'to' => data['username'],
11+
'msg' => URI.escape("#{commit['author']['name']} - #{commit['message']}", Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")),
12+
'label' => 'GitHub Commit',
13+
'title' => URI.escape("#{repository}", Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")),
14+
'uri' => URI.escape(commit['url'], Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
15+
)
16+
17+
net = Net::HTTP.new(url.host, 443)
18+
net.use_ssl = true
19+
net.verify_mode = OpenSSL::SSL::VERIFY_NONE
20+
net.start { |http| http.request(req) }
21+
end
22+
end

0 commit comments

Comments
 (0)