Module: PagerDuty::Client::Addons
- Included in:
- PagerDuty::Client
- Defined in:
- lib/pager_duty/client/addons.rb
Overview
Third-party developers can write their own add-ons to PagerDuty’s UI, to add HTML to the product.
Given a configuration containing a <tt>src</ttd> parameter, that URL will be embedded in an iframe on a page that’s available to users from a drop-down menu.
Instance Method Summary collapse
-
#addon(id, options = {}) ⇒ Sawyer::Resource
(also: #get_addon)
Get details about an existing add-on.
-
#addons(options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_addons)
List add-ons.
-
#delete_addon(id) ⇒ Boolean
Remove an existing add-on.
-
#install_addon(type, name, src, options = {}) ⇒ Sawyer::Resource
(also: #create_addon)
Creates an add-on in the associated account.
-
#update_addon(id, options = {}) ⇒ Sawyer::Resource
Updates addon.
Instance Method Details
#addon(id, options = {}) ⇒ Sawyer::Resource Also known as: get_addon
Get details about an existing add-on.
37 38 39 40 |
# File 'lib/pager_duty/client/addons.rb', line 37 def addon(id, = {}) response = get "/addons/#{id}", response[:addon] end |
#addons(options = {}) ⇒ Array<Sawyer::Resource> Also known as: list_addons
List add-ons
19 20 21 22 23 24 25 26 27 |
# File 'lib/pager_duty/client/addons.rb', line 19 def addons( = {}) query = Hash.new query["include[]"] = "services" if .fetch(:include_services, false) query["service_ids[]"] = .fetch(:service_ids, []) query["filter"] = [:filter] if [:filter] && [:full_page_addon, :incident_show_addon].include?([:filter]) response = get "/addons", .merge({query: query}) response[:addons] end |
#delete_addon(id) ⇒ Boolean
Remove an existing add-on.
71 72 73 |
# File 'lib/pager_duty/client/addons.rb', line 71 def delete_addon(id) boolean_from_response :delete, "/addons/#{id}" end |
#install_addon(type, name, src, options = {}) ⇒ Sawyer::Resource Also known as: create_addon
Creates an add-on in the associated account
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pager_duty/client/addons.rb', line 52 def install_addon(type, name, src, = {}) params = { addon: { type: type, name: name, src: src } } response = post "/addons", .merge(params) response[:addon] end |
#update_addon(id, options = {}) ⇒ Sawyer::Resource
Updates addon
85 86 87 88 89 90 91 92 |
# File 'lib/pager_duty/client/addons.rb', line 85 def update_addon(id, = {}) # params = {addon: {}} # params[:addon][:type] = options[:type] if options.key?(:type) # params[:addon][:name] = options[:name] if options.key?(:name) # params[:addon][:src] = options[:src] if options.key?(:src) response = put "addons/#{id}", response[:addon] end |