This repository is meant to be a practice assessment for Mod 3 BE.
Skills:
- API Consumption
- Feature testing for API data using Webmock and fixture data (and/or VCR)
- Refactoring into facade/service patterns, and optional PORO
Requires Ruby 3.2.2 and Rails 7.1.2
- Fork/clone this repository. Set up the repo as normal
- Run the usual setup steps (
bundle install
,rails db:create
)
- Review the FruityVice API - this is a free service with no API Key requirement.
- Make some test calls in Postman and/or your browser to get a feel for how it works.
- The base url for this API is https://www.fruityvice.com
- When ready, complete the user story below.
NOTE: This application comes with a pre-built form at the "welcome#index"
action and view. Do not change the path for this form, rather make the pre-existing form work alongside the user story below.
As a user,
When I visit the root path ("/"),
I see a form with a search box for fruit and a button.
When I enter the name of a fruit and click "Search"
I am taken to the "/fruits" page
And I see information about that fruit, including
- name
- family
- order
- genus
- nutrition value, organized as:
"Calories: x
Fat: x
Sugar: x
Carbohydrates: x
Protein: x
"
As a user,
When I am on a search result page "/fruits"
after making a successful search,
I see a link that says "Find Similar Fruits by Nutrition Value"
When I click this link
I am taken to a "/fruits/nutritional" page
Where I see the names of fruits that have a similar nutritional value
# Hint: choose a specific nutritional key (e.g. "calories" or "fat" or "sugar"), and use the min/max API endpoints
As a user,
When I use the Nutritional Value search
and I see the names of fruits that have similar nutritional value,
I can click on the names of each fruit
and I am taken to the "/fruits" page
where I see that specific fruit's information similar to the original search:
- name
- family
- order
- genus
- nutrition value, organized as:
"Calories: x
Fat: x
Sugar: x
Carbohydrates: x
Protein: x
"