CatalogApi v0.0.13 CatalogApi.CartItem View Source

Defines the CatalogApi.CartItem struct and functions which are responsible for parsing items in a user’s cart from CatalogApi responses.

Link to this section Summary

Functions

Converts JSON representing an item in a user’s cart and returns a %CatalogApi.CartItem{} struct

Extracts %CatalogApi.CartItem{} struct(s) from a raw parsed json response

Link to this section Types

Link to this type t() View Source
t() :: %CatalogApi.CartItem{
  cart_price: term(),
  catalog_item_id: term(),
  catalog_points: term(),
  catalog_price: term(),
  currency: term(),
  error: term(),
  image_uri: term(),
  is_available: term(),
  is_valid: term(),
  name: term(),
  points: term(),
  quantity: term(),
  retail_price: term(),
  shipping_estimate: term()
}

Link to this section Functions

Link to this function cast(item_json) View Source
cast(map()) :: t()

Converts JSON representing an item in a user’s cart and returns a %CatalogApi.CartItem{} struct.

Link to this function extract_items_from_json(arg1) View Source
extract_items_from_json(map()) ::
  {:ok, [t()]} | {:error, :unparseable_catalog_api_items}

Extracts %CatalogApi.CartItem{} struct(s) from a raw parsed json response.

If the parsed json response is not handled, returns an error tuple of the format {:error, :unparseable_catalog_api_items}.