Class: PagerDuty::Configuration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/pagerduty/configuration.rb

Instance Attribute Summary

Attributes inherited from Common::Client::Configuration::Base

#base_request_headers, #open_timeout, #read_timeout, #request_types, #user_agent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Common::Client::Configuration::Base

#breakers_error_threshold, #breakers_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception

Class Method Details

.service_idsObject



33
34
35
# File 'lib/pagerduty/configuration.rb', line 33

def self.service_ids
  Settings.maintenance.services&.to_hash&.values || []
end

.service_mapObject



29
30
31
# File 'lib/pagerduty/configuration.rb', line 29

def self.service_map
  Settings.maintenance.services&.to_hash&.invert || {}
end

Instance Method Details

#base_pathObject



21
22
23
# File 'lib/pagerduty/configuration.rb', line 21

def base_path
  Settings.maintenance.pagerduty_api_url
end

#connectionObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pagerduty/configuration.rb', line 9

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |conn|
    conn.use :breakers
    conn.request :json

    conn.response :raise_custom_error, error_prefix: service_name
    conn.response :json_parser

    conn.adapter Faraday.default_adapter
  end
end

#service_nameObject



25
26
27
# File 'lib/pagerduty/configuration.rb', line 25

def service_name
  'PagerDuty'
end