module URLHelper

Constants

COURSES
REGIONS

Public Instance Methods

course_base_url(course_type) click to toggle source
# File lib/allrecipes/url_helper.rb, line 75
def course_base_url(course_type)
  "http://allrecipes.com/recipes/" + COURSES[course_type]
end
ingredient_sort_parameter(sort_type) click to toggle source
# File lib/allrecipes/url_helper.rb, line 101
def ingredient_sort_parameter(sort_type)
  case sort_type
    when "rating" then "ra"
    when "popularity" then "p"
    else "re"
  end
end
recipe_filters(options) click to toggle source
# File lib/allrecipes/url_helper.rb, line 89
def recipe_filters(options)
  "?page=#{options[:page]}&st=#{search_sort_parameter(options[:sort_by])}"
end
recipes_url(type, options) click to toggle source
# File lib/allrecipes/url_helper.rb, line 83
def recipes_url(type, options)
  base = send("#{options[:url_type]}_base_url", type)
  filters = recipe_filters(options)
  [base, filters].join
end
region_base_url(region_type) click to toggle source
# File lib/allrecipes/url_helper.rb, line 79
def region_base_url(region_type)
  "http://allrecipes.com/recipes/world-cuisine/" + REGIONS[region_type]
end
search_sort_parameter(sort_type) click to toggle source
# File lib/allrecipes/url_helper.rb, line 93
def search_sort_parameter(sort_type)
  case sort_type
    when "date" then "n"
    when "title" then "t"
    else "p"
  end
end