Skip to content

vertilux/vizion

Repository files navigation

Vizion

Vizion is a ruby gem client library for talking to VIZION API built using OpenStruct so you can easily access data in a Ruby-ish way.

https://badge.fury.io/rb/vizion.svg

Installation

Add this line to your application’s Gemfile:

gem 'vizion'

And then execute:

bundle

Or install it yourself as:

gem install vizion

Usage

You’ll need to generate an api key: https://vizionapi.com/sign-up Initialize client and making request:

require 'vizion'
client = Vizion::Client.new(api_key: "X-API-Key", timeout: 10)
client.carriers

Resources

Carriers

List of all supported carriers, to view the list click here.

Actions supported:

client.carriers.list

References

Actions supported:

client.references.list
client.references.retrieve(id)
client.references.updates(id)
client.references.create({})
client.references.delete(id)

Pagination

Use the page query parameter to set the current page (default: 1)
Use the per_page query parameter to set a per page limit (default: 25)

client.references.list(per_page: 10, page:2)

Create Reference with Auto Carrier Identification.

Add container reference for update tracking without a carrier code. To do this, provide only a container_id with in the body request payload. Please note, it will always be faster and more accurate to provide a carrier code when you can.
VIZION API will periodically check for updates and send updates via HTTP POST to the provided callback_url parameter.

Raw body

{
    "container_id": "CMAU4049810",
    "callback_url": "https://yourdomain.com/webhook"
}

Ruby way

client.references.create(container_id: "CMAU4049810", callback_url: "https://yourdomain.com/webhook")

Create Reference with Carrier Code

Add container reference for update tracking using a carrier code.

Raw body

{
    "container_id": "CAIU4482704",
    "carrier_code": "HDMU",
    "callback_url": "https://yourdomain.com/webhook"
}

Ruby way

client.references.create(container_id: "CMAU4049810", carrier_code: "HDMU", callback_url: "https://yourdomain.com/webhook")

If no callback_url parameter is provided, you will need to fetch status updates from the reference_updates action.

Milestones event names

Here you can find information on how Vizion standardizes event names.

Milestones Event NameDescription
Available for release / deliveryReleased by carrier
Barge arrivedContainer has been moved by barge to next point of transit
Barge departedBarge is en route to next destination
Carrier releaseCargo can be picked up by consignee
Customs releaseContainer has cleared customs
DeliveredContainer has been delivered to destination
Discharged from bargeContainer is no longer on the barge
Discharged from feederContainer is no longer on the feeder will move by next mode of transportation
Discharged from railContainer is no longer on the rail
Discharged from truckContainer is no longer on the truck
Discharged from vesselContainer is no longer on the vessel
Discharged from vessel at transshipment portContainer is no longer on the vessel and is in transit to the next mode of transport
Discharged transshipmentContainer is no longer on the vessel
Estimated arrival at destinationEstimated time vessel will arrive at destination port
Estimated Time of ArrivalEstimated time vessel will arrive at destination port
Feeder arrivedFeeder has arrived at port
Feeder departedFeeder has departed port
Gate inContainer is checked in at either port of origin or destination
Gate in at destination portContainer is checked in at destination port
Gate in at inland destinationContainer is checked in at an inland location
Gate in at origin portContainer is checked in at port of origin
Gate in emptyContainer is returned empty after being used - goods are emptied and container is returned
Gate in empty returnContainer is returned empty after being used - goods are emptied and container is returned
Gate in fullContainer has been loaded and is ready to board the vessel
Gate outContainer has left the terminal
Gate out emptyEmpty container has been picked up. This starts the clock for detention (equipment)
Gate out from destination portContainer has left the destination port
Gate out from origin portContainer has left the terminal
Gate out to consigneeConsignee (person consigner shipped goods to) picked up the container
LoadedContainer is loaded on the vessel
Loaded on bargeContainer is loaded on the barge
Loaded on feederContainer is loaded on the feeder
Loaded on railContainer is on the rail
Loaded on rail at destination portContainer is on the rail at the destination port
Loaded on truckContainer is on the truck
Loaded on vesselContainer is on the vessel
Loaded on vessel at origin portContainer is on the vessel at origin
Loaded on vessel at transshipment portContainer has moved to transshipment port and is loaded on the vessel
Loaded transshipmentContainer has moved to transshipment port and is loaded on the vessel
Picked up by customerThe customer has picked up the container
Rail arrivedContainer is on the rail and has arrived at next point
Rail demurrage noticeRail company has issued a notice regarding demurrage
Rail departedContainer is on the rail and has departed
Rail departed from inland originContainer is on the rail and has departed from the inland origin
Stripping emptyCargo has been removed from container and has been cleaned
StuffingContainer is being loaded with cargo, usually at the warehouse or by truck at the terminal
Transshipment delayContainer is experiencing delays at the transshipment port
Truck arrivedTruck is at the terminal to pick up container
Truck delivery scheduledTruck has made appointment to deliver container
Truck departedTruck has departed the terminal
Truck pickup scheduledTruck has scheduled an appointment with the terminal to pick up the container
Vessel arrivalVessel has arrived at the port
Vessel arrival at transshipment portVessel has arrived at the transshipment port
Vessel arrivedVessel has arrived at the port
Vessel arrived at destination portVessel has arrived at the destination port
Vessel arrived at origin portVessel has arrived at the origin port
Vessel berthed in portVessel has berthed or arrived at designated port at the terminal. Container should be available for pick up
Vessel departedVessel has departed the port
Vessel departure from origin portVessel has departed from the origin port
Vessel departure from transshipment portVessel has departed from the transshipment port
VGM receivedVGM (verified gross mass) paperwork is in order

Contributing

Everyone is encouraged to help improve this project. Bug reports and pull requests are welcome at https://github.com/vertilux/vizion/pulls. Feel free to open an issue to get feedback on your idea before spending too much time on it.

License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).