@@ -205,6 +205,9 @@ def user_agent
205205 # :include_score_percentiles::
206206 # include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
207207 #
208+ # :warnings::
209+ # warnings(optional) : Whether to add list of warnings (if any) to response.
210+ #
208211 # ==== Returns:
209212 #
210213 # In the case of a network error (timeout, broken connection, etc.),
@@ -223,6 +226,7 @@ def track(event, properties = {}, opts = {})
223226 force_workflow_run = opts [ :force_workflow_run ]
224227 abuse_types = opts [ :abuse_types ]
225228 include_score_percentiles = opts [ :include_score_percentiles ]
229+ warnings = opts [ :warnings ]
226230
227231 raise ( "event must be a non-empty string" ) if ( !event . is_a? String ) || event . empty?
228232 raise ( "properties cannot be empty" ) if properties . empty?
@@ -235,8 +239,12 @@ def track(event, properties = {}, opts = {})
235239 query [ "return_route_info" ] = "true" if return_route_info
236240 query [ "force_workflow_run" ] = "true" if force_workflow_run
237241 query [ "abuse_types" ] = abuse_types . join ( "," ) if abuse_types
238- if include_score_percentiles == "true"
239- query [ "fields" ] = "SCORE_PERCENTILES"
242+
243+ if include_score_percentiles == "true" || warnings == "true"
244+ fields = [ ]
245+ fields << "SCORE_PERCENTILES" if include_score_percentiles == "true"
246+ fields << "WARNINGS" if warnings == "true"
247+ query [ "fields" ] = fields . join ( "," )
240248 end
241249
242250 options = {
0 commit comments