If you are not familiar with programming concepts like variable
, function
and class
,
you can refer to the following resources
Create a Ruby application that fetches the latest news from the NewsAPI and displays the results on an HTML page in a well-structured and visually appealing format.
The API call must be made in Ruby without using an NewAPI client library.
- Create an account at NewsAPI and get the API key from your profile.
- Go through the documentation
- Write a Ruby program to fetch
- The top 10 headlines of the day
- Include a search input to search for articles with the given search query.
- Display the data in an HTML file and use CSS to make it visually pleasing.
- Once you have completed the assignment, submit a Pull Request with your work to the branch
week1_assignment
(notmain
). - Status of your grading will be indicated using GitHub tags on your PR.
- Fork and Clone this repository.
- Create a folder called
submission
in theweek_1
folder and add all your files in this submission folder. So all your work for this week should be there in the submission folder of week_1. - Once you have completed the assignment, submit a Pull Request with your work to the branch
week1_assignment
(notmain
). - Add any screenshots (if needed) to the PR description.
- Status of your grading will be indicated using GitHub tags on your PR.
To do these assignments, and follow the bootcamp along in the subsequent weeks, you will definitely need a code editor. Notepad is decent, but won't do the trick for the upcoming sessions.
There are many free code editors to download, such as VS Code, Sublime text, etc. We will be giving instructions to download and setup VS Code:
- Open a web browser and go to the VS Code website (https://code.visualstudio.com/).
- Click the "Download" button.
- Select the appropriate version for your operating system (Windows, macOS, or Linux).
- Follow the prompts to complete the installation.
Follow this guide to setup your workspace
- Make sure you are in the correct directory(week_1) while running commands
cd week_1
rvm gemset create week_1
rvm use 3.0.5@week_1
ruby <file_name>
You can use the interactive ruby (irb
) to help understand and debug
your code. irb
is similar to python's interactive console and lets you
run any ruby code.
For example, to debug prime_numbers.rb
do the following:
-
Open a ruby console using
irb
. -
Include the ruby program using
require_relative '<file_name>'
. -
Execute the function (or any valid ruby statement using the interpreter).