Why I Started This Project
While working at Hire Dragons, I encountered a big challenge. There was a task that needed to be automated completely. Every day, someone would log into Ramp.com to handle routine tasks like checking upcoming shifts on our website and pre-filling a card using the Ramp service. This was their whole job because we have over 1,000 Dragons (users) possibly working shifts each day.
How I Solved the Problem
Initially, I looked into integrating a solution directly into our existing codebase. However, it seemed too complex and I thought, "Why not make this an open-source project?" Since the Ramp API is accessible to anyone with an account, I decided to share the fun with everyone!
I created a project called "ramp-api" on GitHub to make using the Ramp API as easy as possible for developers.
Getting Started with the Ramp API Package
To use this package, first, you need to set up your configuration file. You can do this by running the following command in your terminal:
php artisan vendor:publish --tag=rampapi-config
Next, include the package in your project:
use R0aringthunder\RampApi\Ramp;
Using the Code
Here are some simple examples from the GitHub page showing how to use the package:
// List all Ramp users
public function rampUsers()
{
$ramp = new Ramp();
$users = $ramp->users->listUsers();
return response()->json($users);
}
// List all cards
public function fetchCards()
{
$ramp = new Ramp();
$cards = $ramp->cards->listCards();
return response()->json($cards['data']);
}
// List a single user's cards
public function fetchUserCards(Request $request)
{
$ramp = new Ramp();
$cards = $ramp->cards->listCards('user_id', $request->uid);
return response()->json($cards['data']);
}
For a longer list of functionalities, please check the README.md on the project’s GitHub page.
Comments
Post a Comment