Class: AzureFunctions::HTTPTriggerClient
- Inherits:
-
Object
- Object
- AzureFunctions::HTTPTriggerClient
- Defined in:
- lib/fluent/plugin/azurefunctions/client.rb
Instance Method Summary collapse
-
#initialize(endpoint, function_key) ⇒ HTTPTriggerClient
constructor
A new instance of HTTPTriggerClient.
- #post(payload) ⇒ Object
Constructor Details
#initialize(endpoint, function_key) ⇒ HTTPTriggerClient
Returns a new instance of HTTPTriggerClient.
3 4 5 6 7 8 9 10 11 |
# 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 |
Instance Method Details
#post(payload) ⇒ Object
13 14 15 16 17 18 19 20 |
# 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 |