class AzureFunctions::HTTPTriggerClient

Public Class Methods

new(endpoint, function_key) click to toggle source
# File lib/fluent/plugin/azurefunctions/client.rb, line 3
def initialize (endpoint, function_key)
  require 'rest-client'
  require 'json'
  @endpoint = endpoint
  @headers = {
    'Content-Type' => "application/json; charset=UTF-8",
    'x-functions-key' => function_key
  }
end

Public Instance Methods

post(payload) click to toggle source
# File lib/fluent/plugin/azurefunctions/client.rb, line 13
def post(payload)
  raise ConfigError, 'no payload' if payload.empty?
  res = RestClient.post(
          @endpoint,
          { :payload => payload }.to_json,
          @headers)
  res
end