Class: Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/robot_sweatshop/payload/payload.rb

Overview

The base interface that the payload parser will be expecting

Direct Known Subclasses

BitbucketPayload, GithubPayload, JSONPayload

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hash_keysObject



3
4
5
# File 'lib/robot_sweatshop/payload/payload.rb', line 3

def self.hash_keys
  %w(author hash branch message repo_slug source_url clone_url)
end

Instance Method Details

#to_hashObject



7
8
9
10
11
# File 'lib/robot_sweatshop/payload/payload.rb', line 7

def to_hash
  keys = Payload.hash_keys
  values = Payload.hash_keys.map { |method| method(method.to_sym).call }
  [keys, values].transpose.to_h
end