Download the PHP package fieldnation/fieldnation-sdk without Composer
On this page you can find all versions of the php package fieldnation/fieldnation-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fieldnation/fieldnation-sdk
More information about fieldnation/fieldnation-sdk
Files in fieldnation/fieldnation-sdk
Package fieldnation-sdk
Short Description An SDK to Get Work Done
License Apache-2.0
Informations about the package fieldnation-sdk
WE do not support SOAP API for new developement, This code is for reference only
Field Nation PHP SDK
- Build Status
- Installation
- PHP Support
- PHP Requirements
- Installation with Composer
- Usage
- Authentication
- Environment
- Create a Work Order
- Work Order Actions and Metadata
- Publish
- Route to Provider
- Route to Group
- Approve
- Cancel
- Attach Documents
- Detach Documents
- Add a Message
- Add a Custom Field
- Add a Label
- Remove a Label
- Resolving a Closeout Requirements
- Add a Shipment
- Delete a Shipment
- Update Schedule
- Get the Entire Work Order
- Get the Status
- Get the Assigned Provider
- Get Progress
- Get Payment
- Get Messages
- Get Attached Documents
- Get Shipments
- Get Your Work Orders
- Get Your Projects
- Get Your Documents
- Convert a Tracking Number to a Shipping ID
- Using Your Classes
- Contributing
- Tests
- Coding Standards
- Changelog
- License
Build Status
Installation
PHP Support
- PHP 5.6+
- PHP 7+
- HHVM
PHP Requirements
Your php runtime needs to have Soap enabled. Follow the installation instructions for enabling the Soap module.
Installation with Composer
Require the fieldnation/fieldnation-sdk
package in your project.
Usage
The key concept to successfully integrating with Field Nation is describing how your business objects become Field Nation objects. We provide interfaces for describing how your data can be created on Field Nation.
Authentication
To use the SDK you need to generate an API key for your company.
You can create an API key at https://app.fieldnation.com/api
. Once you have a key you can create a connection.
`
Environment
The default environment for the SDK is set to production. If you would like to use another environment for testing you can do so by setting the value on the credentials object.
Create a Work Order
First, let's create a simple example of what your data model might look like.
Now that we have our business logic in our MyBusinessTicket
, how can we start creating work orders
on Field Nation? Simple -- we update MyBusinessTicket
to implement FieldNation\WorkOrderSerializerInterface
(or better yet, create a new class MyFieldNationBusinessTicket
that extends MyBusinessTicket
and implements
FieldNation\WorkOrderSerializerInterface
).
Let's take a second to break down what we added.
These methods are a requirement of the WorkOrderSerializerInterface
. This interface describes how your data
translates to Field Nation data, and is a requirement of the SDK for creating work orders.
Each method is documented with what it does, and what the return type should be. For more information about
the types see the interfaces section.
There are a number of methods that require you to map your data to a type that is provided by the SDK.
Let's use getPayInfo
as an example. Field Nation requires a specific schema for describing the pay info for a work order.
Because we don't know how you pay technicians, we provide an interface, PayInfoInterface
, for translating your
pay structure into a pay structure that we understand. The PayInfoInterface
acts as container for the potential pay
types -- FixedPayInterface
, RatePayInterface
, and BlendedPayInterface
. Each of these pay
interfaces also has a concrete class provided with the SDK (FixedPay
, RatePay
, BlendedPay
).
You can use the classes that we've implemented to translate your pay structure into a Field Nation pay structure, or you
could create your own concrete classes that implement the provided interfaces.
Now that we understand how our business objects translate to Field Nation business objects we can create a work order. `
Work Order Actions and Metadata
Updating a work order is similar to creating a work order, but there are granular actions that you can make on a work order instance.
There are 2 ways of getting a Field Nation work order object. 1) If you just created one through the SDK::createWorkOrder method 2) If you called the SDK::getExistingWorkOrder method.
Now that you have a Field Nation work order instance you can execute actions or get metadata about it.
Publish
Publish your work order on Field Nation
Route to Provider
Route your work order to a Provider. When creating a Provider object you need to set the Provider ID so it will be properly routed.
Route to Group
Route your work order to a Group. When creating a Group object you need to set the Group ID so it will be properly routed.
Approve
Approve your work order.
Cancel
Sometimes you need to cancel your work order and start over.
Attach Documents
Attach a document to your work order.
Detach Documents
Remove a document from your work order.
Add a Custom Field
Your work orders are yours. Make them yours by adding a custom field.
Add a Label
Add labels to your work order.
Remove a Label
Remove a label from your work order.
Resolving a Closeout Requirement
Mark a closeout requirement as resolved.
Add a Shipment
Add a shipment for Field Nation to track to your work order.
Delete a Shipment
If a shipment no longer needs to be tracked delete it from your work order.
Update Schedule
Things change -- update the schedule for your work order.
Get the Entire Work Order
Occasionally it makes sense to get the entire work order. Here's how!
If you need something specific you should be calling that getter directly. This action is expensive so use it when you really need it.
Get the Status
Get the status of your work order
Get the Assigned Provider
Get the information about the Provider that is assigned to your work order.
Get Progress
Get the progress of your work order.
Get Payment
Get the payment information about your work order.
Get Messages
Get the messages on your work order
Get Attached Documents
Get the attached documents on your work order.
Get Shipments
Get the tracked shipments for your work order.
Get Your Work Orders
Sometimes you need to get all of your work orders. Here's how!
Get Your Projects
Use to get all of the projects for your company.
Get Your Documents
Get all of the documents for your company.
Convert a Tracking Number to a Shipping ID
If you have a tracking number for a shipment you created, but didn't save the Field Nation shipping ID you can get it here.
Using Your Classes
You may be wondering if you have to use our PHP classes. The good news is that you don't! We implement all of our own
interfaces with plain ol' php objects as a set of defaults, but if your classes implement our interfaces you can
configure the SDK to use your classes. The only hard rule we have is that your class must implement the interface
for the type you're trying to inject. If your class doesn't implement the interface we will throw a TypeError
.
Example replacing our WorkOrder
with your class that implements our WorkOrderInterface
.
Here is a list of all of the classes that are considered injectable.
Contributing
Tests
All merge requests require tests passing tests. Merge requests will not be approved if the tests do not pass, and if there are no new tests for the changes.
Coding Standards
We follow the PSR-2 coding style. We will lint the code and merge requests will not be approved if they do not pass linting. You can lint using PHP_CodeSniffer.
If you have lint errors or warnings you can try to auto clean them with composer lint:fix
. If the errors/warnings can't be
fixed on their own you will have to manually fix them. composer lint:check
should always exit with a 0.
Changelog
Please see the CHANGELOG
or view the releases.
License
Copyright © 2017 Field Nation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.