Sha256: c5b308084b26796ccc84c94448e0a279649a14a6316e4ffb39a3ef49a77c5b35
Contents?: true
Size: 874 Bytes
Versions: 67
Compression:
Stored size: 874 Bytes
Contents
# frozen_string_literal: true module PlatformSdk module OpsGenie # Client for OpsGenie API class Client attr_reader :connection OPSGENIE_API_URL = "https://api.opsgenie.com" def initialize(opsgenie_secret, conn = nil) raise ArgumentError, "opsgenie_secret cannot be nil" unless opsgenie_secret @connection = conn || build_connection(opsgenie_secret) end def heartbeat(heartbeat_name) connection.get("v2/heartbeats/#{heartbeat_name}/ping") end private def build_connection(secret) Faraday.new(url: OPSGENIE_API_URL) do |conn| conn.request :url_encoded conn.request :retry conn.response :raise_error conn.adapter Faraday.default_adapter conn.headers[:Authorization] = "GenieKey #{secret}" end end end end end
Version data entries
67 entries across 67 versions & 1 rubygems