Skip to content

Commit

Permalink
Added rake task for publishing coderwall badges
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Dec 29, 2012
1 parent e8ea8c7 commit 1c6226f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/tasks/coderwall.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace :coderwall do
desc 'Register coderwall awards'
task :awards => :environment do
conn = Faraday.new(:url => 'https://coderwall.com')
api_key = ENV['CODERWALL_API_KEY']
if api_key.present?
User.all.each do |user|
if user.pull_requests.any?
payload = {github:user.nickname, badge:"TwentyFourPullRequestsParticipant", date:"12/25/2012", api_key:api_key}
resp = conn.post '/award', payload.to_json, 'Content-Type' => 'application/json', :accept => 'application/json'
end
if user.pull_requests.length > 23
payload = {github:user.nickname, badge:"TwentyFourPullRequestsContinuous", date:"12/25/2012", api_key:api_key}
resp = conn.post '/award', payload.to_json, 'Content-Type' => 'application/json', :accept => 'application/json'
end
end
end
end
end

0 comments on commit 1c6226f

Please sign in to comment.