Jumingo
Ruby client for the Jumingo shipping API.
Installation
Install the gem and add to the application's Gemfile by executing:
bundle add jumingoIf bundler is not being used to manage dependencies, install the gem by executing:
gem install jumingoUsage
require "jumingo"
client = Jumingo::Client.new(
Jumingo::Configuration.new.tap do |config|
config.api_key = "your-api-key"
config.base_url = "https://api.jumingo.com"
config.timeout = 30
config.open_timeout = 10
end
)Jumingo::Client API Reference
Carrier:
-
POST /v1/carrier/access-points-search→carrier_access_points_search(payload)
Cart:
-
POST /v1/cart/total→cart_total(payload)
Connections:
-
GET /v1/connections→list_connections(params: {}) -
GET /v1/connections/{uuid}→get_connection(uuid) -
POST /v1/connections→create_connection(payload)
Orders:
-
GET /v1/orders→list_orders(params: {}) -
GET /v1/orders/{id}→get_order(id) -
GET /v1/orders/{id}/documents→get_order_documents(id) -
POST /v1/orders→create_order(payload)
Shipments:
-
GET /v1/shipments→list_shipments(params: {}) -
GET /v1/shipments/{shipment_id}→get_shipment(shipment_id) -
POST /v1/shipments→create_shipment(payload) -
PUT /v1/shipments/{shipment_id}→update_shipment(shipment_id, payload) -
PATCH /v1/shipments/{shipment_id}→patch_shipment(shipment_id, payload) -
DELETE /v1/shipments/{shipment_id}→delete_shipment(shipment_id) -
POST /v1/shipments/cheapest→cheapest_shipment_rate(payload, params: {}) -
POST /v1/shipments/{uuid}/file/upload/{type}→upload_shipment_file(uuid, type, file) -
DELETE /v1/shipments/{uuid}/file/upload/{type}→delete_shipment_file(uuid, type)
Shipment Rates:
-
POST /v1/shipment-rates→create_shipment_rate(payload)
Example Calls
client.list_orders(params: { page: 1, itemsPerPage: 20 })
client.create_shipment({ reference: "ORDER-123" })
client.upload_shipment_file("s_fbf8e2a57185478194fa264583b5b388", "commercial-invoice", "/path/to/invoice.pdf")Pagination Helper
client.each_page("/orders", params: { itemsPerPage: 50 }) do |orders|
puts orders.count
endError Handling
begin
client.get_order("missing-id")
rescue Jumingo::Errors::NotFound => e
puts e.status
puts e.body
endOpenAPI Source
The OpenAPI definition used to implement this client is stored at openapi/jumingo.yaml.
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/florian2/jumingo.
License
The gem is available as open source under the terms of the MIT License.