Skip to content

Latest commit

 

History

History
 
 

week_1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Week 1

Topics Covered

Video Resources

If you are not familiar with programming concepts like variable, function and class, you can refer to the following resources

Assignment

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.

Steps to follow

  1. Create an account at NewsAPI and get the API key from your profile.
  2. Go through the documentation
  3. 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.
  4. 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 (not main).
  • Status of your grading will be indicated using GitHub tags on your PR.

Submission Instructions

  • Fork and Clone this repository.
  • Create a folder called submission in the week_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 (not main).
  • Add any screenshots (if needed) to the PR description.
  • Status of your grading will be indicated using GitHub tags on your PR.

Installing a code editor

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.

Pre-requisites

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>

Interactive Console

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).

  • How to use IRB to Explore Ruby