Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

added timeout option to pagerduty #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/redphone/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def http_request(options={})
parameters = options[:parameters] || Hash.new
body = options[:body]
http = Net::HTTP.new(uri.host, uri.port)
http.open_timeout = options[:timeout] if options[:timeout]
http.read_timeout = options[:timeout] if options[:timeout]
if options[:ssl] == true
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Expand Down
3 changes: 3 additions & 0 deletions lib/redphone/pagerduty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def incidents(options={})
:password => @password,
:ssl => true,
:uri => "https://#{@subdomain}.pagerduty.com/api/v1/incidents",
:timeout => options[:timeout],
:parameters => options
)
JSON.parse(response.body)
Expand All @@ -70,6 +71,7 @@ def incidents_count(options={})
:password => @password,
:ssl => true,
:uri => "https://#{@subdomain}.pagerduty.com/api/v1/incidents/count",
:timeout => options[:timeout],
:parameters => options
)
JSON.parse(response.body)
Expand All @@ -82,6 +84,7 @@ def schedules(options={})
:password => @password,
:ssl => true,
:uri => "https://#{@subdomain}.pagerduty.com/api/v1/schedules/#{options[:schedule_id]}/entries",
:timeout => options[:timeout],
:parameters => options
)
JSON.parse(response.body)
Expand Down