Class: TxghServer::Webhooks::Git::DeleteAttributes
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Git::DeleteAttributes
show all
- Defined in:
- lib/txgh-server/webhooks/git/delete_attributes.rb
Constant Summary
collapse
- ATTRIBUTES =
[
:event, :repo_name, :ref, :ref_type
]
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of DeleteAttributes.
29
30
31
32
33
34
35
|
# File 'lib/txgh-server/webhooks/git/delete_attributes.rb', line 29
def initialize(options = {})
ATTRIBUTES.each do |attr|
instance_variable_set(
"@#{attr}", options.fetch(attr) { options.fetch(attr.to_s) }
)
end
end
|
Class Method Details
.event(payload) ⇒ Object
18
19
20
|
# File 'lib/txgh-server/webhooks/git/delete_attributes.rb', line 18
def event(payload)
'delete'
end
|
.from_webhook_payload(payload) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/txgh-server/webhooks/git/delete_attributes.rb', line 10
def from_webhook_payload(payload)
new(
ATTRIBUTES.each_with_object({}) do |attr, ret|
ret[attr] = public_send(attr, payload)
end
)
end
|
.ref(payload) ⇒ Object
22
23
24
|
# File 'lib/txgh-server/webhooks/git/delete_attributes.rb', line 22
def ref(payload)
payload.fetch('ref')
end
|
Instance Method Details
#to_h ⇒ Object
37
38
39
40
41
|
# File 'lib/txgh-server/webhooks/git/delete_attributes.rb', line 37
def to_h
ATTRIBUTES.each_with_object({}) do |attr, ret|
ret[attr] = public_send(attr)
end
end
|