Method: Elasticsearch::API::MachineLearning::Actions#delete_calendar

Defined in:
lib/elasticsearch/api/actions/machine_learning/delete_calendar.rb

#delete_calendar(arguments = {}) ⇒ Object

Deletes a calendar.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :calendar_id (String)

    The ID of the calendar to delete

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/machine_learning/delete_calendar.rb', line 32

def delete_calendar(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "ml.delete_calendar" }

  defined_params = [:calendar_id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'calendar_id' missing" unless arguments[:calendar_id]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _calendar_id = arguments.delete(:calendar_id)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_ml/calendars/#{Utils.__listify(_calendar_id)}"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end