in elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/get_calendars.rb [45:77]
def get_calendars(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'ml.get_calendars' }
defined_params = [:calendar_id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
end
request_opts[:defined_params] = defined_params unless defined_params.empty?
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
body = arguments.delete(:body)
_calendar_id = arguments.delete(:calendar_id)
method = if body
Elasticsearch::API::HTTP_POST
else
Elasticsearch::API::HTTP_GET
end
path = if _calendar_id
"_ml/calendars/#{Utils.listify(_calendar_id)}"
else
'_ml/calendars'
end
params = Utils.process_params(arguments)
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end