assemblymade/coderwall

View on GitHub
app/jobs/github_badge_org_job.rb

Summary

Maintainability
A
0 mins
Test Coverage
class GithubBadgeOrgJob
  include Sidekiq::Worker

  sidekiq_options queue: :github

  def perform(username, action)
    user = User.find_by_username(username)
    unless user.nil? or user.github.nil?
      if action.to_sym == :add
        GithubBadge.new.add_all(user.badges, user.github)
      elsif action.to_sym == :remove
        GithubBadge.new.remove_all(user.badges, user.github)
      end
    end
  end
end