on_intent("THE_REVEAL") do
# # Access the slots
# slots = request.intent.slots
# puts slots.to_s
# # pull in the users from the amazon.US.FIRST_NAME Slot
# diet = request.intent.slots["diet"]
response.should_end_session = false
session_attributes[:userName]
session_attributes[:ingredients]
session_attributes[:cuisine]
session_attributes[:dislikes]
session_attributes[:intolerances]
session_attributes[:diet]
#WORKING WAY TO EXTRACT SESSION INFORMATION
attributes = session.attributes
puts attributes.to_s
rawIngredients = session.attributes["ingredients"]
savedIngredients = CGI::escape(rawIngredients)
attributes = session.attributes
puts attributes.to_s
savedCuisine = session.attributes["cuisine"]
attributes = session.attributes
puts attributes.to_s
savedDislikes = session.attributes["dislikes"]
attributes = session.attributes
puts attributes.to_s
savedIntolerances = session.attributes["intolerances"]
attributes = session.attributes
puts attributes.to_s
savedDiets = session.attributes["diet"]
api_url = "https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/searchComplex?addRecipeInformation=false&cuisine=" + savedCuisine + "&diet=" + savedDiets + "&excludeIngredients=" + savedDislikes + "&fillIngredients=false&includeIngredients=" + savedIngredients + "&instructionsRequired=true&intolerances=" + savedIntolerances + "&limitLicense=false"
rawName = find_recipe api_url
cleanName = rawName.tr('&', '')
recipeImage = find_image api_url
recipeURL = find_URL api_url
# add a response to Alexa using ssml to add pauses
response.set_output_speech_ssml('<speak> Alright, lets make ' + cleanName + '<break time="2s"/> Keep an eye on your phone I\'m texting you some details now. Does this recipe look good to you? </speak>')
end
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .