Class: TxghServer::Webhooks::Github::DeleteAttributes
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Github::DeleteAttributes
- Defined in:
- lib/txgh-server/webhooks/github/delete_attributes.rb
Constant Summary collapse
- ATTRIBUTES =
[ :repo_name, :ref, :ref_type ]
Class Method Summary collapse
- .from_webhook_payload(payload) ⇒ Object
- .ref(payload) ⇒ Object
- .ref_type(payload) ⇒ Object
- .repo_name(payload) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DeleteAttributes
constructor
A new instance of DeleteAttributes.
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ DeleteAttributes
Returns a new instance of DeleteAttributes.
33 34 35 36 37 38 39 |
# File 'lib/txgh-server/webhooks/github/delete_attributes.rb', line 33 def initialize( = {}) ATTRIBUTES.each do |attr| instance_variable_set( "@#{attr}", .fetch(attr) { .fetch(attr.to_s) } ) end end |
Class Method Details
.from_webhook_payload(payload) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/txgh-server/webhooks/github/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/github/delete_attributes.rb', line 22 def ref(payload) payload.fetch('ref') end |
.ref_type(payload) ⇒ Object
26 27 28 |
# File 'lib/txgh-server/webhooks/github/delete_attributes.rb', line 26 def ref_type(payload) payload.fetch('ref_type') end |
.repo_name(payload) ⇒ Object
18 19 20 |
# File 'lib/txgh-server/webhooks/github/delete_attributes.rb', line 18 def repo_name(payload) payload.fetch('repository').fetch('full_name') end |
Instance Method Details
#to_h ⇒ Object
41 42 43 44 45 |
# File 'lib/txgh-server/webhooks/github/delete_attributes.rb', line 41 def to_h ATTRIBUTES.each_with_object({}) do |attr, ret| ret[attr] = public_send(attr) end end |