Class: ZohoSign::Document::ListService

Inherits:
BaseService
  • Object
show all
Includes:
Enumerable
Defined in:
lib/zoho_sign/document/list_service.rb

Constant Summary collapse

SORT_COLUMNS =
%w[request_name folder_name owner_full_name recipient_email form_name created_time].freeze
SORT_ORDERS =
%w[ASC DESC].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#call, #each

Constructor Details

#initialize(offset: 1, limit: Float::INFINITY, sort_column: 'created_time', sort_order: 'DESC', search_columns: {}) ⇒ ListService

List documents.

www.zoho.com/sign/api/document-managment/get-document-list.html

Examples

service = ZohoSign::Document::ListService.call.first
service.request_name

If you don’t provide the ‘limit` argument, multiple API requests will be made untill all records have been returned. You could be rate limited, so use wisely.

ZohoSign::Document::ListService.call(offset: 11, limit: 10).each { _1 }

Sort by column.

ZohoSign::Document::ListService.call(sort_column: 'recipient_email', sort_order: 'ASC').map { _1 }

Filter by column.

ZohoSign::Document::ListService.call(search_columns: { recipient_email: '[email protected]' }).map { _1 }

Columns to sort and filter by are ‘request_name`, `folder_name`, `owner_full_name`, `recipient_email`, `form_name` and `created_time`.

GET /api/v1/requests



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/zoho_sign/document/list_service.rb', line 52

def initialize(offset: 1, limit: Float::INFINITY, sort_column: 'created_time', sort_order: 'DESC', search_columns: {})
  @sort_column    = sort_column
  @sort_order     = sort_order
  @search_columns = search_columns

  super(
    path:         'requests',
    list_key:     'requests',
    facade_klass: ZohoSign::Document::Facade,
    limit:        limit,
    offset:       offset
  )
end

Instance Attribute Details

#search_columnsObject (readonly)

Returns the value of attribute search_columns.



9
10
11
# File 'lib/zoho_sign/document/list_service.rb', line 9

def search_columns
  @search_columns
end

#sort_columnObject (readonly)

Returns the value of attribute sort_column.



9
10
11
# File 'lib/zoho_sign/document/list_service.rb', line 9

def sort_column
  @sort_column
end

#sort_orderObject (readonly)

Returns the value of attribute sort_order.



9
10
11
# File 'lib/zoho_sign/document/list_service.rb', line 9

def sort_order
  @sort_order
end