Method: Keen::Client::MaintenanceMethods#event_collection

Defined in:
lib/keen/client/maintenance_methods.rb

#event_collection(event_collection) ⇒ Object

Return the named collection for the configured project See detailed documentation here: keen.io/docs/api/reference/#event-collection-resource



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/keen/client/maintenance_methods.rb', line 71

def event_collection(event_collection)
  ensure_project_id!
  ensure_master_key!

  begin
    response = http_sync.get(
        :path => "/#{api_version}/projects/#{project_id}/events/#{event_collection}",
        :headers => api_headers(self.master_key, "sync"))
  rescue Exception => http_error
    raise HttpError.new("Couldn't perform events on Keen IO: #{http_error.message}", http_error)
  end

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