This Sinatra app fetches and updates numbers from a given list of JSON URLs from metabase and stores them in an SQLite database. It also provides a simple web interface to manage the URLs and display their numbers. A JSON endpoint is also exposed to view the sum of all the numbers from the various metabase URLs.
- Add and remove URLs to fetch data from
- Fetch and update numbers from the specified URLs
- Schedule tasks to fetch and update numbers at regular intervals
- Display a list of URLs and their associated numbers
- Calculate the sum of all numbers
- Ruby 2.6 or higher
- Bundler gem
- Clone the repository:
git clone https://github.com/basilkhan05/metabase-to-shopify-counter.git
- Change to the project directory:
cd metabase-to-shopify-counter
- Install dependencies:
bundle install
- Run the application:
rackup -p 4567
- Open your web browser and navigate to
http://localhost:4567/
to start using the application.
-
Add a URL by entering it in the input field and clicking the "Add" button. The URL must return a JSON response with a number.
-
The application will automatically fetch and update the numbers from the specified URLs every 30 seconds.
-
View the list of URLs and their associated numbers by navigating to
http://localhost:4567/
. -
Remove a URL by clicking the "Delete" button next to the corresponding URL in the list.
-
Get the sum of all numbers by sending a GET request to
http://localhost:4567/sum.json
. The response will be a JSON object containing the sum.
This project is licensed under the MIT License - see the LICENSE file for details.