Skip to content

Commit

Permalink
Print Direct Sales
Browse files Browse the repository at this point in the history
  • Loading branch information
serra committed Sep 5, 2024
1 parent d24b50a commit e98fba7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/floridayvine/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typer
from importlib.metadata import version
from .minio import MinioClient
from .floriday.misc import get_organizations, get_trade_items
from .floriday.misc import get_organizations, get_trade_items, get_direct_sales
from pprint import pprint


Expand Down Expand Up @@ -53,6 +53,12 @@ def floriday_connection_info():
pprint(orgs)


@app.command()
def print_direct_sales():
items = get_direct_sales()
pprint(items)


@app.command()
def print_trade_items():
trade_items = get_trade_items()
Expand Down
11 changes: 9 additions & 2 deletions src/floridayvine/floriday/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pprint import pprint
import requests

from floriday_supplier_client import TradeItemsApi, api_factory
from floriday_supplier_client import TradeItemsApi, api_factory, DirectSalesApi

CLIENT_ID = os.getenv("FLORIDAY_CLIENT_ID")
CLIENT_SECRET = os.getenv("FLORIDAY_CLIENT_SECRET")
Expand Down Expand Up @@ -30,6 +30,7 @@ def get_access_token():


_api_factory = api_factory.ApiFactory()
_clt = _api_factory.get_api_client()


def get_organizations():
Expand All @@ -48,11 +49,17 @@ def get_organizations():


def get_trade_items():
api = TradeItemsApi(_api_factory.get_api_client())
api = TradeItemsApi(_clt)
items = api.get_trade_items()
return items


def get_direct_sales():
api = DirectSalesApi(_clt)
items = api.get_supply_lines()
return items


def sync_trade_items(base_sync_number=0):
access_token = get_access_token()
url = f"{BASE_URL}/trade-items/sync/{base_sync_number}"
Expand Down
3 changes: 1 addition & 2 deletions work/backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Containers are pushed to <ghcr.io/serraict/vine-floriday-adapter>.

## Doing

* generate an api client
* retrieve "Supply Line" information

## Next

Expand All @@ -21,7 +21,6 @@ Containers are pushed to <ghcr.io/serraict/vine-floriday-adapter>.
## Later

* Goal: show open quotations for a supplier on Floriday.
* retrieve "Supply Line" information
* create a Serra Vine dashboard for open quotations
* Goal: learn/ understand the FLoriday api
* Watch Floriday instruction videos and read som tutorials
Expand Down

0 comments on commit e98fba7

Please sign in to comment.