class Fluent::GoogleChatClient::Base
The base framework of google_chat client
Constants
- SCOPE
Attributes
debug_dev[RW]
https_proxy[R]
keyfile[R]
log[RW]
Public Class Methods
new(keyfile = nil, https_proxy = nil)
click to toggle source
@param [String] endpoint
(Incoming Webhook) required https://hooks.slack.com/services/XXX/XXX/XXX (Slackbot) required https://xxxx.slack.com/services/hooks/slackbot?token=XXXXX (Web API) optional and default to be https://slack.com/api/
@param [String] https_proxy
(optional)
https://proxy.foo.bar:port
# File lib/fluent/plugin/google_chat_client.rb, line 35 def initialize(keyfile = nil, https_proxy = nil) self.keyfile = keyfile if keyfile self.https_proxy = https_proxy if https_proxy @log = Logger.new('/dev/null') end
Public Instance Methods
https_proxy=(https_proxy)
click to toggle source
# File lib/fluent/plugin/google_chat_client.rb, line 59 def https_proxy=(https_proxy) @https_proxy = URI.parse(https_proxy) @proxy_class = Net::HTTP.Proxy(@https_proxy.host, @https_proxy.port) end
keyfile=(keyfile)
click to toggle source
# File lib/fluent/plugin/google_chat_client.rb, line 55 def keyfile=(keyfile) @keyfile = keyfile end
post(params)
click to toggle source
# File lib/fluent/plugin/google_chat_client.rb, line 68 def post(params) chat = Chat::HangoutsChatService.new chat.authorization = authorize message = Chat::Message.new message.text = params[:text].length > 4096 ? params[:text][0...4096] : params[:text] chat.create_space_message( 'spaces/%s' % params[:space], message ) end
proxy_class()
click to toggle source
# File lib/fluent/plugin/google_chat_client.rb, line 64 def proxy_class @proxy_class ||= Net::HTTP end