Application for process labels packages and calculates if there is an overweight directly in the Fedex services.
-
Ruby version:
ruby: 2.6.3
-
System dependencies
Rails: 6.0.2
Postgres
Run:
bundle install
Create Database:
rake db:create
rake db:migrate
Run server:
rails s
For execute test run:
rails test
https://skydrop.herokuapp.com/
- Enter to http://0.0.0.0:3000/packages
- Click on Load labels button.
- Load label json in text area.
- Click in send.
Method: POST
Endpoint: api/v1/packages
Body:
curl -X POST \
http://0.0.0.0:3000/api/v1/packages \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 3da1f1d5-a7f5-4c8b-b94a-eafd8a10ca14' \
-H 'cache-control: no-cache' \
-d '{
"package":[
{
"tracking_number":"149331877648230",
"carrier":"FEDEX",
"parcel":{
"length":29.7,
"width":5,
"height":21,
"weight":2.0,
"distance_unit":"CM",
"mass_unit":"KG"
}
}
]
}
'
Response:
[
{
"tracking_number": "149331877648230",
"carrier": "FEDEX",
"parcel": {
"length": 29.7,
"width": 5,
"height": 21,
"weight": 2,
"distance_unit": "CM",
"mass_unit": "KG"
},
"overweight": true,
"fedex_volumetric_weight": 9,
"higher_label_weight": 2,
"tag_processed": true
}
]
You can change the next enviroment variables:
# Fedex Service Vars
export FEDEX_KEY='yourfaboulousvar'
export FEDEX_PASSWORD='yourfaboulousvar'
export FEDEX_ACCOUNT_NUMBER='yourfaboulousvar'
export FEDEX_METER='yourfaboulousvar'
export FEDEX_MODE='yourfaboulousvar'
# Database Var
export SKYDROP_HOST_DB='yourfaboulousvar'
export SKYDROP_USER_DB='yourfaboulousvar'
export SKYDROP_PASS_DB='yourfaboulousvar'
export SKYDROP_DB_PORT='yourfaboulousvar'
export SKYDROP_DB_NAME='yourfaboulousvar'
- Create service for resend label when fedex service failed.