Class: Fluent::SlackClient::Base
- Inherits:
-
Object
- Object
- Fluent::SlackClient::Base
- Defined in:
- lib/fluent/plugin/slack_client.rb
Overview
The base framework of slack client
Direct Known Subclasses
Instance Attribute Summary collapse
-
#debug_dev ⇒ Object
Returns the value of attribute debug_dev.
-
#log ⇒ Object
Returns the value of attribute log.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #post(endpoint, params) ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/fluent/plugin/slack_client.rb', line 12 def initialize @log = Logger.new('/dev/null') end |
Instance Attribute Details
#debug_dev ⇒ Object
Returns the value of attribute debug_dev.
10 11 12 |
# File 'lib/fluent/plugin/slack_client.rb', line 10 def debug_dev @debug_dev end |
#log ⇒ Object
Returns the value of attribute log.
10 11 12 |
# File 'lib/fluent/plugin/slack_client.rb', line 10 def log @log end |
Instance Method Details
#post(endpoint, params) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/slack_client.rb', line 16 def post(endpoint, params) http = Net::HTTP.new(endpoint.host, endpoint.port) http.use_ssl = (endpoint.scheme == 'https') http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.set_debug_output(debug_dev) if debug_dev req = Net::HTTP::Post.new(endpoint.path) req['Host'] = endpoint.host req['Accept'] = 'application/json; charset=utf-8' req['User-Agent'] = 'fluent-plugin-slack' req.body = encode_body(params) res = http.request(req) response_check(res, params) end |