Ltix.DeepLinking.ContentItem.LTIResourceLink (Ltix v0.2.0)

Copy Markdown View Source

An LTI resource link content item for Deep Linking responses.

All fields are optional. The platform can use the tool's base URL when no url is provided. Include a line_item to have the platform auto-create a gradebook column for the link.

See Building Content Items for common patterns including line items, custom parameters, and availability windows.

Examples

iex> {:ok, link} = Ltix.DeepLinking.ContentItem.LTIResourceLink.new(
...>   url: "https://tool.example.com/quizzes/7",
...>   line_item: [score_maximum: 100]
...> )
iex> Ltix.DeepLinking.ContentItem.to_map(link)
%{"type" => "ltiResourceLink", "url" => "https://tool.example.com/quizzes/7", "lineItem" => %{"scoreMaximum" => 100}}

Options

  • :title (String.t/0) - Title for the content item.

  • :text (String.t/0) - Plain-text description.

  • :extensions (nil | map/0) - Required. Vendor-specific extension properties. The default value is %{}.

  • :available (map/0)

  • :url (String.t/0) - Launch URL for the resource link.

  • :line_item (map/0) - Gradebook column for the platform to create, as a keyword list, map, or Ltix.GradeService.LineItem.

  • :submission (map/0)

  • :custom (map/0) - Custom parameter key-value pairs.

  • :icon (map/0) - Icon or thumbnail for the LTI resource link.

  • :thumbnail (map/0) - Icon or thumbnail for the LTI resource link.

  • :window (map/0) - Window presentation for the LTI resource link.

  • :iframe (map/0)

Summary

Functions

Create a new LTI resource link content item.

Same as new/1 but raises on error.

Types

t()

@type t() :: %Ltix.DeepLinking.ContentItem.LTIResourceLink{
  available:
    nil
    | %{
        optional(:start_date_time) => DateTime.t(),
        optional(:end_date_time) => DateTime.t()
      },
  custom: nil | %{optional(binary() | atom()) => binary()},
  extensions: nil | %{optional(binary() | atom()) => any()},
  icon:
    nil
    | %{
        optional(:width) => integer(),
        :url => binary(),
        optional(:height) => integer()
      },
  iframe:
    nil | %{optional(:width) => integer(), optional(:height) => integer()},
  line_item:
    nil
    | %{
        optional(:label) => binary(),
        optional(:tag) => binary(),
        :score_maximum => number(),
        optional(:resource_id) => binary(),
        optional(:grades_released) => boolean()
      },
  submission:
    nil
    | %{
        optional(:start_date_time) => DateTime.t(),
        optional(:end_date_time) => DateTime.t()
      },
  text: nil | binary(),
  thumbnail:
    nil
    | %{
        optional(:width) => integer(),
        :url => binary(),
        optional(:height) => integer()
      },
  title: nil | binary(),
  url: nil | binary(),
  window:
    nil
    | %{
        optional(:width) => integer(),
        optional(:height) => integer(),
        optional(:target_name) => binary(),
        optional(:window_features) => binary()
      }
}

Functions

new(opts)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, Exception.t()}

Create a new LTI resource link content item.

Takes the module's options as a keyword list or map, and nested options such as icon may also be keyword lists. Unknown or invalid options return an Ltix.Errors.Invalid.InvalidField error.

Examples

iex> {:ok, link} = Ltix.DeepLinking.ContentItem.LTIResourceLink.new([])
iex> link.url
nil

iex> {:ok, link} = Ltix.DeepLinking.ContentItem.LTIResourceLink.new(url: "https://tool.example.com")
iex> link.url
"https://tool.example.com"

new!(opts)

@spec new!(keyword() | map()) :: t()

Same as new/1 but raises on error.

Examples

iex> Ltix.DeepLinking.ContentItem.LTIResourceLink.new!(title: "Quiz 1").title
"Quiz 1"