Class: Codeclimate::Collectors::Pagerduty::ApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/codeclimate/collectors/pagerduty/api_client.rb

Constant Summary collapse

BASE_URL =
"https://api.pagerduty.com".freeze
ResponseError =
Class.new(StandardError)
NotFound =
Class.new(ResponseError)
Unauthorized =
Class.new(ResponseError)
ServerError =
Class.new(ResponseError)

Instance Method Summary collapse

Constructor Details

#initialize(api_token) ⇒ ApiClient

Returns a new instance of ApiClient.



15
16
17
# File 'lib/codeclimate/collectors/pagerduty/api_client.rb', line 15

def initialize(api_token)
  @api_token = api_token
end

Instance Method Details

#get(path, params = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/codeclimate/collectors/pagerduty/api_client.rb', line 19

def get(path, params = {})
  uri = construct_uri(path, params)
  req = Net::HTTP::Get.new(uri)
  set_headers(req)
  make_request(req)
end