Sha256: c14a9b87b9b028a6db65ff2b67427e891c7edc748465871d08797ea37f495c5f

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

module Keen
  class Client
    module MaintenanceMethods

      # Runs a delete query.
      # See detailed documentation here:
      # https://keen.io/docs/maintenance/#deleting-event-collections
      #
      # @param event_collection
      # @param params [Hash] (optional)
      #   filters (optional) [Array]
      def delete(event_collection, params={})
        ensure_project_id!
        ensure_master_key!

        query_params = preprocess_params(params) if params != {}

        begin
          response = Keen::HTTP::Sync.new(self.api_url, self.proxy_url).delete(
              :path => [api_event_collection_resource_path(event_collection), query_params].compact.join('?'),
              :headers => api_headers(self.master_key, "sync"))
        rescue Exception => http_error
          raise HttpError.new("Couldn't perform delete of #{event_collection} on Keen IO: #{http_error.message}", http_error)
        end

        response_body = response.body ? response.body.chomp : ''
        process_response(response.code, response_body)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
keen-0.8.2 lib/keen/client/maintenance_methods.rb
keen-0.8.1 lib/keen/client/maintenance_methods.rb
keen-0.8.0 lib/keen/client/maintenance_methods.rb
keen-0.7.8 lib/keen/client/maintenance_methods.rb
keen-0.7.7 lib/keen/client/maintenance_methods.rb