Class: TxghServer::Webhooks::Gitlab::PushAttributes

Inherits:
TxghServer::Webhooks::Git::PushAttributes show all
Defined in:
lib/txgh-server/webhooks/gitlab/push_attributes.rb

Constant Summary

Constants inherited from TxghServer::Webhooks::Git::PushAttributes

TxghServer::Webhooks::Git::PushAttributes::ATTRIBUTES

Class Method Summary collapse

Methods inherited from TxghServer::Webhooks::Git::PushAttributes

after, before, event, #files, from_webhook_payload, #initialize, ref, #to_h

Constructor Details

This class inherits a constructor from TxghServer::Webhooks::Git::PushAttributes

Class Method Details

.added_files(payload) ⇒ Object



10
11
12
# File 'lib/txgh-server/webhooks/gitlab/push_attributes.rb', line 10

def added_files(payload)
  extract_files(payload, 'added')
end

.author(payload) ⇒ Object



18
19
20
# File 'lib/txgh-server/webhooks/gitlab/push_attributes.rb', line 18

def author(payload)
  payload.fetch('user_name')
end

.extract_files(payload, state) ⇒ Object



22
23
24
# File 'lib/txgh-server/webhooks/gitlab/push_attributes.rb', line 22

def extract_files(payload, state)
  payload.fetch('commits').flat_map { |c| c[state] }.uniq
end

.modified_files(payload) ⇒ Object



14
15
16
# File 'lib/txgh-server/webhooks/gitlab/push_attributes.rb', line 14

def modified_files(payload)
  extract_files(payload, 'modified')
end

.repo_name(payload) ⇒ Object



6
7
8
# File 'lib/txgh-server/webhooks/gitlab/push_attributes.rb', line 6

def repo_name(payload)
  payload.fetch('project', {})['path_with_namespace']
end