Class: Bl::Webhooks

Inherits:
Command show all
Defined in:
lib/bl/webhooks.rb

Instance Method Summary collapse

Methods included from Printer

print_response, printable_issues

Methods included from Formatting

colorize_priority, colorize_status, colorize_type

Methods included from Requestable

client, formatter, request

Constructor Details

#initializeWebhooks

Returns a new instance of Webhooks.



4
5
6
7
8
# File 'lib/bl/webhooks.rb', line 4

def initialize(*)
  @config = Bl::Config.instance
  @url = "projects/#{@config[:project_key]}/webhooks"
  super
end

Instance Method Details

#addObject



24
25
26
27
28
# File 'lib/bl/webhooks.rb', line 24

def add
  res = request(:post, @url, options.to_h)
  puts 'webhook added'
  print_response(res)
end

#delete(id) ⇒ Object



39
40
41
42
43
# File 'lib/bl/webhooks.rb', line 39

def delete(id)
  res = request(:delete, "#{@url}/#{id}")
  puts 'webhook deleted'
  print_response(res)
end

#listObject



11
12
13
14
# File 'lib/bl/webhooks.rb', line 11

def list
  res = request(:get, @url)
  print_response(res)
end

#show(id) ⇒ Object



17
18
19
20
# File 'lib/bl/webhooks.rb', line 17

def show(id)
  res = request(:get, "#{@url}/#{id}")
  print_response(res)
end

#update(id) ⇒ Object



32
33
34
35
36
# File 'lib/bl/webhooks.rb', line 32

def update(id)
  res = request(:patch, "#{@url}/#{id}", options.to_h)
  puts 'webhook updated'
  print_response(res)
end