r0aringthunder/ramp-api
最新稳定版本:v1.0.2
Composer 安装命令:
composer require r0aringthunder/ramp-api
包简介
A package geared towards laravel to talk to the ramp.com API.
README 文档
README
Available services
- Accounting
Ex: $ramp->accounting->... - Accounting Connections
Ex: $ramp->accountingconnections->... - Bills
Ex: $ramp->bills->... - Business
Ex: $ramp->business->... - Card Programs - This is not implemented and instead you should use Spend Programs
- Cards
Ex: $ramp->cards->... - Cash Backs
Ex: $ramp->cashbacks->... - Departments
Ex: $ramp->departments->... - Entities
Ex: $ramp->entities->... - Leads
Ex: $ramp->leads->... - Ledger Accounts
Ex: $ramp->ledgeraccounts->... - Limits
Ex: $ramp->limits->... - Locations
Ex: $ramp->locations->... - Memos
Ex: $ramp->memos->... - Merchants
Ex: $ramp->merchants->... - Receipt Integrations
Ex: $ramp->receiptintegrations->... - Receipts
Ex: $ramp->receipts->... - Reimbursements
Ex: $ramp->reimbursements->... - Spend Programs
Ex: $ramp->spendprograms->... - Statements
Ex: $ramp->statements->... - Transactions
Ex: $ramp->transactions->... - Transfers
Ex: $ramp->transfers->... - Users
Ex: $ramp->users->... - Vendors
Ex: $ramp->vendors->...
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...
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-30