Class: Pagerduty::HttpTransport

Inherits:
Object
  • Object
show all
Defined in:
lib/pagerduty/http_transport.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HttpTransport

Returns a new instance of HttpTransport.



13
14
15
16
# File 'lib/pagerduty/http_transport.rb', line 13

def initialize(config)
  @path = config.fetch(:path)
  @proxy = config[:proxy] || {}
end

Instance Method Details

#send_payload(payload) ⇒ Object



18
19
20
21
22
# File 'lib/pagerduty/http_transport.rb', line 18

def send_payload(payload)
  response = post(payload.to_json)
  response.error! unless transported?(response)
  JSON.parse(response.body)
end