Method: Auth::Workflow::Specification#location

Defined in:
app/models/auth/workflow/specification.rb

#locationObject

this has to be resolved from amongst all the options in the specification. it has an order of preference like : if location ids are selected, then return those if within radius is specified, then alongwith it origin_location should also be specified, and if location_categories are specified, then they should also be added to the hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/models/auth/workflow/specification.rb', line 54

def location
	return {:location_ids => selected_location_ids} unless selected_location_ids.blank?
		
	if self.selected_within_radius 
		raise "origin location not provided" unless self.origin_location

		## if the selected location categories are not defined, make them equal to the permitted location categories.
		self.selected_location_categories ||= self.permitted_location_categories

		return {:within_radius => self.selected_within_radius, :origin_location => self.origin_location, :location_categories => self.selected_location_categories}
	end

	return nil
end