Iris.Rigging.BusinessUnit (iris v0.1.0)

This module represents a BusinessUnit in Cordage.

Attributes:

  • id
  • active
  • name
  • code
  • description
  • social_reason
  • address
  • timezone
  • organization_id
  • responsible_id

Link to this section Summary

Functions

Validates if a list of Business Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the business units they are validating.

Validates if a list of Business Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the business units they are validating.

Gets a Business Unit from Rigging. Expects the token of the user making the request, along with the ID of the business unit they are looking for.

Gets a Business Unit from Rigging. Expects the token of the user making the request, along with the ID of the business unit they are looking for.

Link to this section Functions

Link to this function

all!(user_token, ids)

@spec all!(user_token :: String.t(), ids :: [String.t()]) :: [
  %Iris.Rigging.BusinessUnit{
    active: term(),
    address: term(),
    code: term(),
    description: term(),
    id: term(),
    name: term(),
    organization_id: term(),
    responsible_id: term(),
    social_reason: term(),
    timezone: term()
  }
]

Validates if a list of Business Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the business units they are validating.

Token must not contain the "Bearer" prefix. Also, the authorization login will be enforce by Rigging.

Raises a Iris.Error.NotFoundError if no record is matched.

Raises a Iris.Error.UnauthorizedError if Rigging sends an "unauthorized" response.

Examples

iex> BusinessUnit.all!("my valid token", ["my id"])
iex> [%Iris.Rigging.BusinessUnit{}]

iex> BusinessUnit.all!("my valid token", "[not_existing_id]")
iex> ** Iris.Error.NotFoundError

iex> BusinessUnit.all!("my invalid token", ["my id"])
iex> ** Iris.Error.UnauthorizedError
Link to this function

all(user_token, ids)

@spec all(user_token :: String.t(), ids :: [String.t()]) ::
  [
    %Iris.Rigging.BusinessUnit{
      active: term(),
      address: term(),
      code: term(),
      description: term(),
      id: term(),
      name: term(),
      organization_id: term(),
      responsible_id: term(),
      social_reason: term(),
      timezone: term()
    }
  ]
  | []

Validates if a list of Business Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the business units they are validating.

Token must not contain the "Bearer" prefix. Also, the authorization login will be enforce by Rigging.

Examples

iex> BusinessUnit.all("my valid token", ["my id"])
iex> [%Iris.Rigging.BusinessUnit{}]

iex> BusinessUnit.all("my valid token", "[not_existing_id]")
iex> :not_found
Link to this function

get!(user_token, id)

@spec get!(user_token :: String.t(), id :: String.t()) :: %Iris.Rigging.BusinessUnit{
  active: term(),
  address: term(),
  code: term(),
  description: term(),
  id: term(),
  name: term(),
  organization_id: term(),
  responsible_id: term(),
  social_reason: term(),
  timezone: term()
}

Gets a Business Unit from Rigging. Expects the token of the user making the request, along with the ID of the business unit they are looking for.

Token must not contain the "Bearer" prefix. Also, the authorization login will be enforce by Rigging.

Raises a Iris.Error.NotFoundError if no record is matched.

Raises a Iris.Error.UnauthorizedError if Rigging sends an "unauthorized" response.

Examples

iex> BusinessUnit.get!("my valid token", "my id")
iex> %Iris.Rigging.BusinessUnit{}

iex> BusinessUnit.get!("my valid token", "invalid id")
iex> ** Iris.Error.NotFoundError

iex> BusinessUnit.get!("my invalid token", "my id")
iex> ** Iris.Error.UnauthorizedError
Link to this function

get(user_token, id)

@spec get(user_token :: String.t(), id :: String.t()) ::
  {:ok,
   %Iris.Rigging.BusinessUnit{
     active: term(),
     address: term(),
     code: term(),
     description: term(),
     id: term(),
     name: term(),
     organization_id: term(),
     responsible_id: term(),
     social_reason: term(),
     timezone: term()
   }}
  | {:error, %Iris.Error.NotFoundError{__exception__: term(), message: term()}}
  | {:error,
     %Iris.Error.UnauthorizedError{__exception__: term(), message: term()}}

Gets a Business Unit from Rigging. Expects the token of the user making the request, along with the ID of the business unit they are looking for.

Token must not contain the "Bearer" prefix. Also, the authorization login will be enforce by Rigging.

Examples

iex> BusinessUnit.get("my valid token", "my id")
iex> {:ok, %Iris.Rigging.BusinessUnit{}}

iex> BusinessUnit.get("my valid token", "invalid id")
iex> {:error, %Iris.Error.NotFoundError}

iex> BusinessUnit.get("my invalid token", "my id")
iex> {:error, %Iris.Error.UnauthorizedError}