class Readiness::Pagerduty::Client
@since 1.0.0
@author Jason Colyer
Defines the class Client within the module {Readiness::Pagerduty}.
#
def generate_connection(config)
-
(Object)
-
Parameters:
-
config
(Object
) -- An instance of {Readiness::Zendesk::Configuration}
Other tags:
- Since: - 1.0.0
Other tags:
- Author: - Jason Colyer
def generate_connection(config) Faraday.new('https://api.pagerduty.com') do |c| c.request :retry, retry_options(config) c.adapter Faraday.default_adapter c.request :url_encoded c.headers['Content-Type'] = 'application/json' c.headers['Accept'] = 'application/vnd.pagerduty+json;version=2' c.headers['Authorization'] = "Token token=#{config.token}" end end
def initialize(config = Readiness::Pagerduty::Configuration.new)
-
config
(Object
) -- An instance of {Readiness::Pagerduty::Configuration}
Other tags:
- Since: - 1.0.0
Other tags:
- Author: - Jason Colyer
def initialize(config = Readiness::Pagerduty::Configuration.new) @connection = generate_connection(config) end
def retry_options(config)
-
(Hash)
-
Parameters:
-
config
(Object
) -- An instance of {Readiness::Zendesk::Configuration}
Other tags:
- Since: - 1.0.0
Other tags:
- Author: - Jason Colyer
def retry_options(config) { max: config.retry_max, interval: config.retry_interval, interval_randomness: config.retry_randomness, backoff_factor: config.retry_backoff, exceptions: config.retry_exceptions } end