class GithubPayload

A parser for Github payload data

Public Class Methods

new(payload) click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 6
def initialize(payload)
  @payload = JSON.parse payload || {}
end

Public Instance Methods

author() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 22
def author
  commit['author']
end
branch() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 30
def branch
  @payload['ref'] || ''
end
clone_url() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 18
def clone_url
  repository['clone_url'] || ''
end
commit() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 10
def commit
  @payload['head_commit'] || {}
end
hash() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 26
def hash
  commit['id'] || {}
end
message() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 34
def message
  commit['message'] || ''
end
repo_slug() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 38
def repo_slug
  repository['full_name'] || ''
end
repository() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 14
def repository
  @payload['repository'] || {}
end
source_url() click to toggle source
# File lib/robot_sweatshop/payload/github.rb, line 42
def source_url
  commit['url'] || ''
end