Class: GemCollector::Webhooks
- Inherits:
-
Object
- Object
- GemCollector::Webhooks
- Defined in:
- app/models/gem_collector/webhooks.rb
Instance Method Summary collapse
- #create(full_name) ⇒ Object
-
#initialize(octokit) ⇒ Webhooks
constructor
A new instance of Webhooks.
- #remove(full_name) ⇒ Object
Constructor Details
#initialize(octokit) ⇒ Webhooks
Returns a new instance of Webhooks.
2 3 4 |
# File 'app/models/gem_collector/webhooks.rb', line 2 def initialize(octokit) @octokit = octokit end |
Instance Method Details
#create(full_name) ⇒ Object
6 7 8 9 10 11 |
# File 'app/models/gem_collector/webhooks.rb', line 6 def create(full_name) hook = find_hook(full_name) unless hook @octokit.create_hook(full_name, WEBHOOK_NAME, { url: WEBHOOK_URL, content_type: 'json' }, { events: WEBHOOK_EVENTS, active: true }) end end |
#remove(full_name) ⇒ Object
13 14 15 16 17 18 |
# File 'app/models/gem_collector/webhooks.rb', line 13 def remove(full_name) hook = find_hook(full_name) if hook @octokit.remove_hook(full_name, hook[:id]) end end |