Sha256: b0a87955466b6e63345dbec3af38a682c73ad531b959e08ba003aff3cc4a86d3
Contents?: true
Size: 770 Bytes
Versions: 1
Compression:
Stored size: 770 Bytes
Contents
class PostReceivePayload def initialize(params) parse_params(params) end attr_accessor :agent_email, :commit, :branch def parsed? commit.present? end def parse_params(params) (params = MultiJson.load(params["payload"])) if params.key?("payload") parse_github_style_params(params) if params end def parse_github_style_params(params) self.commit = params["after"] self.agent_email = parse_github_style_agent(params["pusher"]) self.branch = params["ref"].split("/").last if params.key?("ref") end def parse_github_style_agent(pusher) return nil unless pusher && pusher.key?("email") return pusher["email"] unless pusher.key?("name") "#{pusher["name"].inspect} <#{pusher["email"]}>" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.5.0.beta1 | app/models/post_receive_payload.rb |