Module: FileboundClient::Endpoints::Routes

Defined in:
lib/filebound_client/endpoints/routes.rb

Overview

Module for Routes resource endpoint

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
# File 'lib/filebound_client/endpoints/routes.rb', line 5

def self.included(klass)
  klass.instance_eval do
    allow_new :route
    allow_all :routes
  end
end

Instance Method Details

#route_document_to_step(routed_item_id, step_number, comment:, due_date:, user_id:, checklist_data:, route_step_id:, route_step_task_id:) ⇒ nil

Routes a document to a specified step rubocop:disable Metrics/CyclomaticComplexity, Metrics/ParameterLists

Parameters:

  • routed_item_id (long)

    the RoutedItem key

  • step_number (int)

    the step number to route to

  • comment (string)

    optional comment for the step

  • due_date (DateTime)

    optional due date for the routed item

  • user_id (long)

    optional; if reassigning this the user id to reassign to

  • checklist_data (string)

    optional comma-seperated checklist values

  • route_step_id (long)

    optional RouteStep key

  • route_step_task_id (long)

    options RouteStepTask key

Returns:

  • (nil)


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/filebound_client/endpoints/routes.rb', line 42

def route_document_to_step(routed_item_id, step_number, comment:, due_date:, user_id:, checklist_data:,
                           route_step_id:, route_step_task_id:)
  params = { id: routed_item_id, stepNumber: step_number }
  params[:comment] = comment if comment
  params[:dueDate] = due_date if due_date
  params[:userId] = user_id if user_id
  params[:checklistData] = checklist_data if checklist_data
  params[:routeStepId] = route_step_id if route_step_id
  params[:routeStepTaskId] = route_step_task_id if route_step_task_id
  put('/routes', params, nil)
end

#route_document_to_user(document_id, user_id, route_back, due_date) ⇒ nil

Routes a document to a user

Parameters:

  • document_id (long)

    document key to route

  • user_id (long)

    user key to route to

  • route_back (bool)

    whether to route the document back when completed

  • due_date (DateTime)

    due date for the document

Returns:

  • (nil)


61
62
63
64
# File 'lib/filebound_client/endpoints/routes.rb', line 61

def route_document_to_user(document_id, user_id, route_back, due_date)
  params = { documentId: document_id, userId: user_id, routeBack: route_back, dueDate: due_date }
  put('/routes', params, nil)
end

#route_document_to_workflow(route_id, document_id, notes) ⇒ RoutedItem

Routes a document to the start of a workflow

Parameters:

  • route_id (long)

    the route key

  • document_id (int)

    the document key to route

  • notes (string)

    optional notes to from the user who started the document down the route

Returns:

  • (RoutedItem)

    a hash of the RoutedItem resource that was added



25
26
27
28
29
# File 'lib/filebound_client/endpoints/routes.rb', line 25

def route_document_to_workflow(route_id, document_id, notes)
  params = { documentId: document_id }
  params[:notes] = notes if notes
  put("/routes/#{route_id}", params, nil)
end

#route_xml(route_id, query_params = nil) ⇒ string

Retrieves xml for a route

Parameters:

  • route_id (int)

    the route key

  • query_params (Hash) (defaults to: nil)

    additional query params to send in the request

Returns:

  • (string)

    string of xml representing route



16
17
18
# File 'lib/filebound_client/endpoints/routes.rb', line 16

def route_xml(route_id, query_params = nil)
  get("/routes/#{route_id}/xml", query_params)
end