class Service::Talker < Service
  string  :url, :token
  boolean :digest

  def receive_push
    repository = payload['repository']['name']
    branch     = branch_name
    commits    = payload['commits']
    token      = data['token']

    http.ssl[:verify] = false
    http.headers["X-Talker-Token"] = token
    http.url_prefix = data['url']

    if data['digest'].to_i == 1 and commits.size > 1
      commit = commits.last
      message = "#{commit['author']['name']} pushed #{commits.size} commits to [#{repository}/#{branch}] #{payload['compare']}"
      http_post 'messages.json', :message => message
    else
      commits.each do |commit|
        message = "#{commit['author']['name']} pushed \"#{commit['message'].split("\n").first}\" -  #{commit['url']} to [#{repository}/#{branch}]"
        http_post 'messages.json', :message => message
      end
    end
  end
end

class Service::Talker < Service
  string  :url, :token
  boolean :digest

  def receive_push
    repository = payload['repository']['name']
    branch     = branch_name
    commits    = payload['commits']
    token      = data['token']

    http.ssl[:verify] = false
    http.headers["X-Talker-Token"] = token
    http.url_prefix = data['url']

    if data['digest'].to_i == 1 and commits.size > 1
      http_post 'messages.json', :message => "#{summary_message} – #{summary_url}"
    else
      http_post 'messages.json', :message => "#{pusher_name} pushed the following commits:"
      commit_messages.each do |message|
        http_post 'messages.json', :message => message
      end
    end
  end
end

Use push helpers to format Talker messages
Use push helpers to format Talker messages

This correctly shows the actual pusher when a push happens instead of
whomever committed the last commit. It will also make the message a tad
more interesting:

  Joe Pusher created some-branch from master (+2 new commits)

instead of

  Mary Committer pushed 2 commits