It is a few weeks into the Flatiron School Software Engineer program and it is project time! The project assignment is to build a Command Line Interface (CLI) that interacts with a website to display data to the user. The requirements i sthat the data provided must go at least one level deep. A “level” is where a user can make a choice and then get detailed information about their choice.
Commence Freak Out!
After spending a good amount of time freaking out, i finally deciede i needed to just pic a topic and go with it. The topic i chose was National Park Services sites. I chose this topic because recently my family and i took two road trips in a sprinter van exploring state and national parks.
National Parks Service API
The National Park Service provides an API to locate National Park Services sites by state.
An API key for this site, once you have a key, the url to the site is as follows, where you pass the sattae code of the state you would like to search for sites in the url query string. “https://developer.nps.gov/api/v1/parks?stateCode=#{state_code}&api_key=#{key}”
Coding Process
After watching Avi’s second videos and reviewing all of the lecture videos I first started with creating a flow chart to understand where i wanted to go and how to go about getting there. This worked out well, and made it easier for me to see the data flow. I proceded with setting up the CLI and creating a skeleton for my project to start on. since my API required a key i had to register for one and provide that information to my CLI in order for it to work. I proceded through the project utilizing the API KEY to retrieve the information I needed to present to the user.
The CLI performs as follows:
-
User is greeted and asked to enter a state code (ex. AL, CA, ME) for the state they would like to see all of the National Parks Services sites for.
-
Once the user chooses a state that they would like to see, all of the National Park Service sites form a list.
-
The user then selects the site they would like information on.
-
The user can decide from ther to look at another site from the original states list or they are given the option to select another state or exit.
One challeng that i struggled with was understanding how the key worked and how to make it a part of my CLI without allowing others to see it. by utilizing rubyguides i was able to navigate through the process.
Overall it was a fun and stressful experience.