 # @option query [function] onError
 exports.handle = (query) ->
 	unless query.url.match(muRegex)? or query.url.match(muGroupRegex)?
-		console.log "is false"
 		return false
 	else
 		isEvent = query.url.match(muRegex)?
 		if isEvent
-			console.log "Is event true"
-			handleEvent query
+			_handleEvent query
 		else
-			handleGroup query
+			_handleGroup query
 		return true
# @option query [object] event
# @option query [function] onSuccess
# @option query [function] onError
handleGroup = (query) ->
	name = (muGroupRegex.exec query.url)[1]
	getGroup
		name: name
		onError: (error) ->
			query.onError
				error: error
				module: 'meetup'
		onSuccess: (muGroup) ->
			group = parseGroup muGroup
			db.setGroup
				group: group
				onSuccess: query.onSuccess
				onError: query.onError


# Check if this is a Meetup url
# @param [string] url
#exports.canHandle = (url) ->
#  return url.match(muRegex)? or url.match(muGroupRegex)?

# Import and url
# @param [object] query

###
meetup is a module that handles fetching events and groups from Meetup.com.
It handles single event URLs as well as group URLs. It only fetches open events.
The Meetup.com API has some rate limiting, which might prevent the module from
fetching.

@example usage
	meetup = require 'meetup'
	
	testEventHandle = () ->
		meetup.handle
			url: "http://www.meetup.com/NNUG-Bergen/events/221170619/"
			onSuccess: (result) ->
				console.log "RESULT", result
			onError: (error) ->
				console.log error.error
	
	testEventHandle()

@author Snorre Magnus Davøen
@copyright Kompiler 2015
###

muAPIKey = (require '../config.coffee').meetup
