Class: Opsgenie::Client
- Inherits:
-
Object
- Object
- Opsgenie::Client
- Defined in:
- lib/opsgenie/client.rb
Constant Summary collapse
- ROOT_PATH =
"https://api.opsgenie.com".freeze
Class Method Summary collapse
Class Method Details
.api_key ⇒ Object
29 30 31 32 33 |
# File 'lib/opsgenie/client.rb', line 29 def api_key raise ConfigurationError.new("Missing API key. Use `Opsgenie.configure(api_key: YOUR_API_KEY)` to set the API key") if Config.opsgenie_api_key.nil? Config.opsgenie_api_key end |
.auth_header ⇒ Object
21 22 23 |
# File 'lib/opsgenie/client.rb', line 21 def auth_header {"Authorization" => "GenieKey #{api_key}"} end |
.get(path) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/opsgenie/client.rb', line 6 def get(path) url = [ ROOT_PATH, version, path ].join("/") HTTParty.get(url, headers) end |
.headers ⇒ Object
15 16 17 18 19 |
# File 'lib/opsgenie/client.rb', line 15 def headers { headers: auth_header } end |
.version ⇒ Object
25 26 27 |
# File 'lib/opsgenie/client.rb', line 25 def version "v2" end |