Class: ZohoSign::Template::ListService

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

Constant Summary collapse

SORT_COLUMNS =
%w[template_name owner_first_name modified_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: 'template_name', sort_order: 'DESC', search_columns: {}) ⇒ ListService

List documents.

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

Examples

service = ZohoSign::Template::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::Template::ListService.call(offset: 11, limit: 10).each { _1 }

Sort by column.

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

Filter by column.

ZohoSign::Template::ListService.call(search_columns: { template_name: 'Eric Template' }).map { _1 }

Columns to sort and filter by are ‘template_name`, `owner_first_name` and `modified_time`.

GET /api/v1/templates



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

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

  super(
    path:         'templates',
    list_key:     'templates',
    facade_klass: ZohoSign::Template::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/template/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/template/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/template/list_service.rb', line 9

def sort_order
  @sort_order
end