Class: PlatformSdk::OpsGenie::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/platform_sdk/ops_genie/client.rb

Overview

Client for OpsGenie API

Constant Summary collapse

OPSGENIE_API_URL =
"https://api.opsgenie.com"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opsgenie_secret, conn = nil) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/platform_sdk/ops_genie/client.rb', line 11

def initialize(opsgenie_secret, conn = nil)
  raise ArgumentError, "opsgenie_secret cannot be nil" unless opsgenie_secret

  @connection = conn || build_connection(opsgenie_secret)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/platform_sdk/ops_genie/client.rb', line 7

def connection
  @connection
end

Instance Method Details

#heartbeat(heartbeat_name) ⇒ Object



17
18
19
# File 'lib/platform_sdk/ops_genie/client.rb', line 17

def heartbeat(heartbeat_name)
  connection.get("v2/heartbeats/#{heartbeat_name}/ping")
end