Module: Documents

Defined in:
lib/documents.rb,
lib/documents/engine.rb,
lib/documents/version.rb,
app/models/documents/form.rb,
app/models/documents/image.rb,
app/models/documents/table.rb,
app/models/documents/video.rb,
app/models/documents/element.rb,
app/models/documents/download.rb,
app/models/documents/paragraph.rb,
app/models/documents/url_value.rb,
lib/documents/field_definition.rb,
app/models/documents/data_value.rb,
app/models/documents/date_value.rb,
app/models/documents/file_value.rb,
app/models/documents/page_break.rb,
app/models/documents/text_value.rb,
app/models/documents/time_value.rb,
app/models/documents/email_value.rb,
app/models/documents/field_value.rb,
app/models/documents/image_value.rb,
app/models/documents/phone_value.rb,
lib/documents/element_definition.rb,
app/models/documents/form_section.rb,
app/models/documents/number_value.rb,
app/models/documents/select_value.rb,
lib/documents/document_definition.rb,
app/models/documents/decimal_value.rb,
app/models/documents/checkbox_value.rb,
app/models/documents/location_value.rb,
app/models/documents/rich_text_value.rb,
app/models/documents/signature_value.rb,
app/models/documents/multi_select_value.rb

Defined Under Namespace

Modules: Container Classes: CheckboxValue, DataValue, DateValue, DecimalValue, DocumentDefinition, Download, Element, ElementDefinition, EmailValue, Engine, FieldDefinition, FieldValue, FileValue, Form, FormSection, Image, ImageValue, LocationValue, MultiSelectValue, NumberValue, PageBreak, Paragraph, PhoneValue, RichTextValue, SelectValue, SignatureValue, Table, TextValue, TimeValue, UrlValue, Video

Constant Summary collapse

VERSION =
"0.1.0"
FieldDefinitionSchema =
Dry::Schema.Params do
  required(:name).filled(:string)
  required(:description).filled(:string)
  required(:field_type).filled(included_in?: %w[Documents::CheckboxValue Documents::DateValue Documents::DateTimeValue Documents::DecimalValue Documents::EmailValue Documents::FileValue Documents::LocationValue Documents::ImageValue Documents::DataValue Documents::MultiSelectValue Documents::NumberValue Documents::PhoneValue Documents::RichTextValue Documents::SelectValue Documents::TextValue Documents::TimeValue Documents::UrlValue Documents::SignatureValue])
  required(:required).filled(:bool)
  optional(:allow_comments).filled(:bool)
  optional(:allow_attachments).filled(:bool)
  optional(:allow_tasks).filled(:bool)
  optional(:default_value).maybe(:string)
  optional(:options).filled(:hash)
  optional(:data_class).filled(:string)
end
ElementDefinitionSchema =
Dry::Schema.Params do
  required(:element).filled(:string, included_in?: %w[paragraph form])
  optional(:description).maybe(:string)
  optional(:html).filled(:string)
  optional(:section_type).filled(:string, included_in?: %w[static repeating])
  optional(:display_type).filled(:string, included_in?: %w[form table])
  optional(:fields).array(Documents::FieldDefinitionSchema)
end
DocumentDefinitionSchema =

Describes a document template, built out of multiple "elements". Each element can be a paragraph or other piece of content, or it could be the definition of a "form", describing the questions the eventual document will contain that must be answered by the end-user

Dry::Schema.Params do
  required(:title).filled(:string)
  required(:elements).array(Documents::ElementDefinitionSchema)
end