Module: FileboundClient::Endpoints::RoutedItems

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

Overview

Module for RoutedItems 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/routed_items.rb', line 5

def self.included(klass)
  klass.instance_eval do
    allow_new :routeditem
    allow_all :routeditems
  end
end

Instance Method Details

#routed_item(routed_item_id, query_params = nil) ⇒ Project

Retrieves a single routed item by its key

Parameters:

  • routed_item_id (int)

    the routed item key

  • query_params (Hash) (defaults to: nil)

    additional query params to send in the request

Returns:

  • (Project)

    routed_item object



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

def routed_item(routed_item_id, query_params = nil)
  get("/routeditems/#{routed_item_id}", query_params)
end

#routed_item_complete_step(routed_item_id, step_number:, step_caption:, comment:, due_date:, user_id:, checklist_data:, route_step_id:, route_step_task_id:) ⇒ Array

Completes the current step for the routed item. The routed_item.id must be not nil and > 0. rubocop:disable Metrics/CyclomaticComplexity, Metrics/ParameterLists, Metrics/PerceivedComplexity

Examples:

Complete the current route step

c = FileboundClient::Client.connect(host: url, username: 'username', password: 'password', use_ntlm: true,
                                    ntlm_user: 'ntlm_user', ntlm_password: 'ntlm_password',
                                    ntlm_domain: 'ntlm_domain')
c.routed_item_complete_step(routed_item)

Parameters:

  • routed_item_id (int)

    the routed item key to update

  • step_number (int)

    the step number to route to

  • step_caption (string)

    the step caption for the step

  • 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:

  • (Array)

    array of RouteTask for the specified route step

Raises:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/filebound_client/endpoints/routed_items.rb', line 50

def routed_item_complete_step(routed_item_id, step_number:, step_caption:, comment:, due_date:, user_id:,
                              checklist_data:, route_step_id:, route_step_task_id:)
  raise Client::FileboundClientException.new('Id is required', 0) unless routed_item_id.greater_than_zero?
  params = {}
  params[:stepNumber] = step_number if step_number
  params[:stepCaption] = step_caption if step_caption
  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("/routeditems/#{routed_item_id}/complete", params, nil)
end

#routed_item_update(routed_item) ⇒ nil

Edits a routed item. The routed_item.id must be not nil and > 0.

Examples:

Update an existing routed item

c = FileboundClient::Client.connect(host: url, username: 'username', password: 'password', use_ntlm: true,
                                    ntlm_user: 'ntlm_user', ntlm_password: 'ntlm_password',
                                    ntlm_domain: 'ntlm_domain')
c.routed_item_update(routed_item)

Parameters:

  • routed_item (Hash)

    the routed item to edit

Returns:

  • (nil)

Raises:



28
29
30
31
# File 'lib/filebound_client/endpoints/routed_items.rb', line 28

def routed_item_update(routed_item)
  raise Client::FileboundClientException.new('Id is required', 0) unless routed_item[:id].greater_than_zero?
  post("/routeditems/#{routed_item[:id]}", nil, routed_item)
end