module Redirector
Public Class Methods
find_logs(shortened_id)
click to toggle source
finds logs associated with the shortened url @params [String] the shortened id to find logs for @returns [Array] the logs for the shortened id as an array
# File lib/redirector.rb, line 5 def Redirector.find_logs shortened_id RedirectLog.where(:redirect_id => find_redirect_by_shortened_id(shortened_id)).to_a end
find_redirect_by_shortened_id(shortened_id)
click to toggle source
# File lib/redirector.rb, line 15 def Redirector.find_redirect_by_shortened_id shortened_id Redirect.where(:shortened_id => shortened_id).to_a.last._id end
number_of_redirect_hits(shortened_id)
click to toggle source
finds the number of times a redirect has been accessed @returns [Integer] the number of times the redirect has been accessed
# File lib/redirector.rb, line 11 def Redirector.number_of_redirect_hits shortened_id RedirectLog.where(:redirect_id => find_redirect_by_shortened_id(shortened_id)).count end