Sha256: 2a43ce6caad1e1b4784e07197d0bd9aa5fd13659414939a221d06155216c79bf
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
require 'httparty' require 'ostruct' module Bearychat class Incoming < OpenStruct include HTTParty DEFAULT_PARAMS = { text: "text, this field may accept markdown", markdown: false, channel: "", attachments: [] } attr_reader :hook def initialize(hook, info={}) @hook = hook super(DEFAULT_PARAMS.merge(info)) end def reset(info) info.each { |key, value| self[key] = value } self end def send if block_given? yield self send() else self.class.post(hook, body: { payload: as_json }) end end def switch(channel) self.channel = channel self end private def as_json to_h.to_json end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bearychat-0.1.1 | lib/bearychat/incoming.rb |
bearychat-0.1.0 | lib/bearychat/incoming.rb |