Sha256: d55d6ed25fc80dc8e8020678448fc119a3a24c5ec77f3db181068d79139b2216

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

# coding: utf-8
require 'net/http'
require 'uri'
require 'json'
require 'bearychat-notifier/http_client'
require 'exception_notifier/bearychat_notifier'

module Bearychat
  class Notifier
    attr_reader :webhook_url, :payload

    def initialize(webhook_url, options = {})
      @webhook_url = webhook_url
      @payload     = options
    end

    def ping(text, options)
      payload.merge!(options)
      payload.merge!(text: text)
      params = { payload: payload.to_json }
      HttpClient.post(webhook_url, params)
    end

    def channel
      payload[:channel]
    end

    def channel=(channel)
      payload[:channel] = channel
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bearychat-notifier-0.0.4 lib/bearychat-notifier.rb
bearychat-notifier-0.0.3 lib/bearychat-notifier.rb
bearychat-notifier-0.0.2 lib/bearychat-notifier.rb