Skip to content

Commit

Permalink
basecamp help
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhyett committed Aug 20, 2008
1 parent df3bb21 commit 9069f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions services/basecamp.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
service :basecamp do |data, payload|
repository = payload['repository']['name']
branch = payload['ref'].split('/').last

payload['commits'].each do |commit|
commit_id = commit['id']
bc = Basecamp.new(data['url'], data['username'], data['password'])
project_id = bc.projects.select { |p| p.name.downcase == data['project'].downcase }.first.id
category_id = bc.message_categories(project_id).select { |category| category.name.downcase == data['category'].downcase }.first.id
bc.post_message(project_id, {
:title => "Commit Notification (#{repository}/#{branch}): #{commit_id}",
basecamp = Basecamp.new(data['url'], data['username'], data['password'])
project_id = basecamp.projects.select { |p| p.name.downcase == data['project'].downcase }.first.id
category_id = basecamp.message_categories(project_id).select { |category| category.name.downcase == data['category'].downcase }.first.id

basecamp.post_message(project_id, {
:title => "Commit Notification (#{repository}/#{branch}): #{commit['id']}",
:body => "`#{commit['message']}`, pushed by #{commit['author']['name']} (#{commit['author']['email']}). View more details for this change at #{commit['url']}.",
:category_id => category_id
})
Expand Down
1 change: 1 addition & 0 deletions vendor/basecamp/lib/basecamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def records(node, path, parameters={})
private

def connect!(url, use_ssl)
url = url.sub(/https?:\/\//, '').chomp('/')
@use_ssl = use_ssl
@url = url
@connection = Net::HTTP.new(url, use_ssl ? 443 : 80)
Expand Down

0 comments on commit 9069f5f

Please sign in to comment.