primitivesocial / bluemoonwrapper
Bluemoon REST API 包装器
Requires
- guzzlehttp/guzzle: ^6.3
- illuminate/support: ~5
- nesbot/carbon: ^1.24.0
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-08-29 05:00:05 UTC
README
为 Laravel 包装 Bluemoon REST API。
安装
通过 Composer
$ composer require primitivesocial/bluemoonwrapper
通过 git 仓库的 composer.json 文件
"repositories" : [ ..., { "type": "package", "package": { "name": "primitivesocial/bluemoonrestwrapper", "version": "0.0.1", "source": { "type" : "git", "url" : "git@github.com:PrimitiveSocial/bluemoon-rest-wrapper.git", "reference" : "0.0.1" }, "dist": { "url": "https://github.com/PrimitiveSocial/bluemoon-rest-wrapper/archive/master.zip", "type": "zip" } } } ]
环境变量
# REST API VARS, THESE ARE REQUIRED BLUEMOON_CLIENT_URL= BLUEMOON_CLIENT_SECRET= BLUEMOON_CLIENT_ID= BLUEMOON_USERNAME= BLUEMOON_PASSWORD= BLUEMOON_LICENSE= # SOAP API VARS BLUEMOON_SOAP_CLIENT_URL= BLUEMOON_SOAP_USERNAME= BLUEMOON_SOAP_PASSWORD= BLUEMOON_SOAP_SERIAL= # BROWSER APPLICATION BLUEMOON_APPLICATION_URL= BLUEMOON_LEASE_URL= BLUEMOON_APPLICATION_API_URL= BLUEMOON_ESIGNATURE_API_URL= BLUEMOON_DEBUG=true
您必须添加一个名为 bluemoon.php
的配置文件。该软件包包含适用于所有三种 Bluemoon 设置的配置文件。
<?php return [ // For use with REST api, so you need this 'rest' => [ 'url' => env('BLUEMOON_CLIENT_URL'), 'secret' => env('BLUEMOON_CLIENT_SECRET'), 'id' => env('BLUEMOON_CLIENT_ID'), 'username' => env('BLUEMOON_USERNAME'), 'password' => env('BLUEMOON_PASSWORD'), 'license' => env('BLUEMOON_LICENSE'), ], // For user with SOAP api if you're using that 'soap' => [ 'url' => env('BLUEMOON_SOAP_CLIENT_URL'), 'username' => env('BLUEMOON_SOAP_USERNAME'), 'password' => env('BLUEMOON_SOAP_PASSWORD'), 'serial' => env('BLUEMOON_SOAP_SERIAL'), ], // For use with in browser application 'application' => [ 'api_url' => env('BLUEMOON_APPLICATION_API_URL'), 'application_url' => env('BLUEMOON_APPLICATION_URL'), 'esignature_url' => env('BLUEMOON_ESIGNATURE_API_URL'), 'lease_url' => env('BLUEMOON_LEASE_URL'), 'license' => env('BLUEMOON_LICENSE'), 'debug' => env('BLUEMOON_DEBUG') ] ];
您还可以通过运行 php artisan vendor:publish
来安装配置。
用法
创建新包装器
包装器接受六个变量。您可以将这些存储在配置中或按以下顺序设置: clientLicense
: Bluemoon 属性许可证。 clientUrl
: Bluemoon API URL clientSecret
: Bluemoon API 密钥 clientId
: Bluemoon API ID clientUsername
: Bluemoon API 用户名 clientPassword
: Bluemoon API 密码
$bm = new BlueMoonWrapper($licenseNumber);
设置器
setPropertyId($id)
: 您正在处理的属性的 Bluemoon 属性 ID setExternalId($id)
: 用于外部识别 ID。有助于跟踪应用程序或租约。 setApplicationId($id)
: Bluemoon 中的应用程序 ID
获取器
getApplications
: 获取所有 Bluemoon 应用程序 getApplication
: 获取在 setApplicationId
中设置的 ID 的 Bluemoon 应用程序 getApplicationAndParse
: 获取在 setApplicationId
中设置的 ID 的 Bluemoon 应用程序并将其解析到其各种类别(例如宠物、车辆) getApplicationFields
: 获取与在 setPropertyId
中设置的属性关联的所有字段 getLeaseFields
: 获取与在 setPropertyId
中设置的属性关联的所有租赁字段 getToken
: 获取 bearer 令牌