Skip to content

ranvold/ranvity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use it

  • Make sure that you have ruby and sqlite3.

To install:

  1. git clone git@github.com:ranvold/ranvity.git
  2. Move to the directory project
  3. bundle install

Then you can use such commands:

bin/ranvity new
bin/ranvity new --type education --participants 1 --price_min 0.1 --price_max 30 --accessibility_min 0.1 --accessibility_max 0.5
bin/ranvity list

Technical Challenge for Juniors

For this challenge, you are going to use the API of bored API. This API gives us a random activity to do every time you call it, for example, if you make the following call:

GET https://www.boredapi.com/api/activity

You will get a response like this:

{
    "activity": "Learn Express.js",
    "type": "education",
    "participants": 1,
    "price": 0.1,
    "link": "https://expressjs.com/",
    "key": "3943509",
    "accessibility": 0.1
}

For more details, check the documentation.

We will use this API to create a simple program that will give us a random activity to do.

Instructions

Clone this repository and create a new one on your own GitHub account. When you are done, please send us the link to your repository.

Tasks

API Calls

  1. Create an API wrapper for bored API, This wrapper should have a method that returns a random activity, and should accept parameters to filter the activities by type, number of participants, price range, and accessibility range.

Database

  1. Write a class that will save the activities in a database, this class should have a method that will accept the activity as a parameter

  2. Add another method that will return the latest activities saved in the database. The database can be any database you want (e.g. SQLite), but it should be a relational database.

Command line program

  1. Create a simple command line program that will use the API wrapper and the database class to get a random activity and save it in the database. The program should accept parameters to filter the activities by type, number of participants, price range, and accessibility range. The command should look like this:

    my_program new --type education --participants 1 --price_min 0.1 --price_max 30 --accessibility_min 0.1 --accessibility_max 0.5

This command should get a random activity with the type education, 1 participant, a price of 0.1, and an accessibility of 0.1 and save it in the database.

  1. Add another command to the program that will return the last activities saved in the database. The command should look like this:

    my_program list

This command should return the last 5 activities saved in the database.

Extra points

  • Make sure that you include a dependencies file (requirements.txt, gemfile, package.json, etc.). But don't include any virtual environment or packages installed in your repository.
  • Add unit tests for your work.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages