Class: GithubPayload
- Defined in:
- lib/robot_sweatshop/payload/github.rb
Overview
A parser for Github payload data
Instance Method Summary collapse
- #author ⇒ Object
- #branch ⇒ Object
- #clone_url ⇒ Object
- #commit ⇒ Object
- #hash ⇒ Object
-
#initialize(payload) ⇒ GithubPayload
constructor
A new instance of GithubPayload.
- #message ⇒ Object
- #repo_slug ⇒ Object
- #repository ⇒ Object
- #source_url ⇒ Object
Methods inherited from Payload
Constructor Details
#initialize(payload) ⇒ GithubPayload
Returns a new instance of GithubPayload.
6 7 8 |
# File 'lib/robot_sweatshop/payload/github.rb', line 6 def initialize(payload) @payload = JSON.parse payload || {} end |
Instance Method Details
#author ⇒ Object
22 23 24 |
# File 'lib/robot_sweatshop/payload/github.rb', line 22 def commit['author'] end |
#branch ⇒ Object
30 31 32 |
# File 'lib/robot_sweatshop/payload/github.rb', line 30 def branch @payload['ref'] || '' end |
#clone_url ⇒ Object
18 19 20 |
# File 'lib/robot_sweatshop/payload/github.rb', line 18 def clone_url repository['clone_url'] || '' end |
#commit ⇒ Object
10 11 12 |
# File 'lib/robot_sweatshop/payload/github.rb', line 10 def commit @payload['head_commit'] || {} end |
#hash ⇒ Object
26 27 28 |
# File 'lib/robot_sweatshop/payload/github.rb', line 26 def hash commit['id'] || {} end |
#message ⇒ Object
34 35 36 |
# File 'lib/robot_sweatshop/payload/github.rb', line 34 def commit['message'] || '' end |
#repo_slug ⇒ Object
38 39 40 |
# File 'lib/robot_sweatshop/payload/github.rb', line 38 def repo_slug repository['full_name'] || '' end |
#repository ⇒ Object
14 15 16 |
# File 'lib/robot_sweatshop/payload/github.rb', line 14 def repository @payload['repository'] || {} end |
#source_url ⇒ Object
42 43 44 |
# File 'lib/robot_sweatshop/payload/github.rb', line 42 def source_url commit['url'] || '' end |