Skip to content

r0aringthunder/ramp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Available services

Publishing the ramp config

Command

php artisan vendor:publish --tag=rampapi-config

published config/ramp.php

<?php

return [
    'client_id' => env('RAMP_CLIENT_ID', 'your_client_id'),
    'client_secret' => env('RAMP_CLIENT_SECRET', 'your_client_secret'),
    'prod_ready' => env('PROD_READY', false),
    'scopes' => env('RAMP_SCOPES', 'accounting:read accounting:write bills:read business:read cards:read cards:write cashbacks:read departments:read departments:write entities:read leads:read leads:write limits:read limits:write locations:read locations:write memos:read merchants:read receipt_integrations:read receipt_integrations:write receipts:read reimbursements:read spend_programs:read spend_programs:write statements:read transactions:read transfers:read users:read users:write'),
];

Examples

Fetching a list of users

use R0aringthunder\RampApi\Ramp;

public function rampUsers()
{
  $ramp = new Ramp();
  $users = $ramp->users->listUsers();
  return response()->json($users);
}

Fetching all cards

use R0aringthunder\RampApi\Ramp;

public function fetchCards()
{
    $ramp = new Ramp();
    $cards = $ramp->cards->listCards();
    return response()->json($cards['data']);
}

Fetching a single card

use R0aringthunder\RampApi\Ramp;

public function fetchCard()
{
  $ramp = new Ramp();
  $card = $ramp->cards->fetchCard('[CARD ID]');
  return response()->json($card);
}

Important

At the time of implementation the API and Ramp dashbaord take approximately 5 minutes to sync but the API reacts immediately to changes

Important

The only file types accepted by Ramp are png, webp, heif, pdf, heic, jpg, jpeg

Uploading a receipt to a transaction

use R0aringthunder\RampApi\Ramp;
use Illuminate\Http\Request;

public function uploadReceipt(Request $request)
{
  $ramp = new Ramp();

  $file = $request->file('receipts');
  $path = $file->getRealPath();

  return $ramp->receipts->upload(
      [
          'user_id' => $request->input('ramp_user_id'),
          'transaction_id' => $request->input('ramp_transaction_id'),
      ],
      $path
  );
}

Tip

On $path you can use an uploaded file or a link to a file (Ex. an S3 link)

More exmaples coming...