/oneflow

Elixir SDK for Oneflow

Primary LanguageElixirMIT LicenseMIT

Oneflow

Build Status Hex package version Coverage Status

The docs can be found at https://hexdocs.pm/oneflow.

Installation

The package can be installed by adding oneflow to your list of dependencies in mix.exs:

def deps do
  [{:oneflow, "~> 0.1.2"}]
end

Configuration

config :oneflow,
  token: "TOKEN",
  secret: "SECRET",
  log: true,
  endpoint: "https://API-URL/api",

Usage

Basic examples

{:ok, order} = Onefelow.get("/order/ORDER-ID")
{:ok, result} = Onefelow.search("query", "shipments", ["status:shipped])

Safety net

To be sure that the required fields are set before placing an order, Surround any structs creation that you implement with a try catch like this:

try do
   %Oneflow.Destination{ name: "awesomePrinter" }
 ....
rescue
   e in ArgumentError -> IO.inspect e
   e in KeyError -> IO.inspect e
end

Useful endpoints

  • /shipping-method
  • /sku