Ruby wrapper for Seko Logistics' SupplyStream iHub REST API v1
SupplyStream REST API Documentation
- Inbound Product Master Upload and method
- Inbound Companies Upload and method
- Inbound Advanced Shipment Notification
- Inbound Sales Order / Cancel Orders
- Retrieve GRN’s
- Retrieve Stock Quantity
- Retrieve Tracking Details
- Retrieve Sales Order Status
- Retrieve Stock Adjustments
- Retrieve Stock Movements
Add this line to your application's Gemfile:
gem 'seko'
And then execute:
$ bundle
Or install it yourself as:
$ gem install seko
config/initializers/seko.rb
Seko.configure(
token: 'SekoAPIToKeN'
supplier_code: 'DEFSUPLJLTD001',
supplier_description: 'Default Supplier LARSSON & JENNINGS LTD',
supplier_uom: 1,
warehouses: {
us: 'US123',
uk: 'UK123'
}
)
client = Seko::Client.new(Seko.config[:token])
response = client.submit_product(upc: "123456", description: 'A test product')
line_items = [ { upc: "123456", quantity: 10 } ]
warehouse = Seko.config[:warehouses][:us]
client = Seko::Client.new(Seko.config[:token])
response = client.submit_receipt(line_item_array, warehouse)
company_hash = {
code: 'IND001',
description: 'Indigina'
}
client = Seko::Client.new(Seko.config[:token])
response = client.submit_company(company_hash)
client = Seko::Client.new(Seko.config[:token])
response = client.get_inventory
client = Seko::Client.new(Seko.config[:token])
response = client.check_grn('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
client = Seko::Client.new(Seko.config[:token])
response = client.order_status('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
client = Seko::Client.new(Seko.config[:token])
response = client.order_tracking('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe')
Seko::Order::CANCEL_CODES
# => {
# "001" => "Customer Request",
# "002" => "Order Delayed",
# "003" => "Duplicate",
# "004" => "Item not available",
# "005" => "Cannot ship to address",
# "006" => "Other"
# }
client = Seko::Client.new(Seko.config[:token])
response = client.cancel_order('5b2dcd8e-52c3-4e27-a712-eaacda2dd8fe', '001')
client = Seko::Client.new(Seko.config[:token])
warehouse = Seko.config[:warehouses][:us]
from = 3.days.ago
to = Time.now
response = client.stock_movements(from, to, warehouse)
client = Seko::Client.new(Seko.config[:token])
warehouse = Seko.config[:warehouses][:us]
from = 3.days.ago
to = Time.now
response = client.stock_adjustments(from, to, warehouse)
client = Seko::Client.new(Seko.config[:token])
warehouse = Seko.config[:warehouses][:us] # warehouse is optional
from = 3.days.ago
to = Time.now
response = client.dispatch_statuses(from, to, warehouse)
# get collection of GUIDs dispatched
guid_array = Seko::Dispatch.parse(response)
# returns something like this
# => ["2b5e52cc-fb6f-4ea4-b8cf-cf64e3a2b8db", "93e92ca2-725a-46f8-90dd-43a16105f78d"]
order = {
shipping_address: {
first_name: "John",
last_name: "Smith",
address1: "123 Here Now",
address2: "2nd Floor",
city: "New York",
state: "New York",
country: "US",
zipcode: "10012",
phone: "123-123-1234"
},
email: "[email protected]",
number: "R123123123",
warehouse: "DC123",
date: "2013-12-12",
line_items: [
{
quantity: "1",
sku: "123332211"
}
]
}
client = Seko::Client.new(Seko.config[:token])
response = client.send_order_request(order)
### NOTE you may want to store the GUID from the response
### you need the guid for status updates, tracking, and canceling orders
response.guid
if response.success?
# DO SOMETHING
else
# QUEUE REQUEST, STORE AND RAISE ERRORS
end
- Fork it ( https://github.com/[my-github-username]/seko/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request