Class: DocFox::DocumentToken::ListService

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#call, #each

Constructor Details

#initialize(document_id:, page: 1, per_page: Float::INFINITY) ⇒ ListService

List document tokens.

https://www.docfoxapp.com/api/v2/documentation#tag/Document-Tokens/paths/~1api~1v2~1documents~1%7Bdocument_id%7D~1document_tokens/get

Examples

service = DocFox::DocumentToken::ListService.call(document_id: '').first
service.id
service.expiry

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

DocFox::DocumentToken::ListService.call(document_id: '', page: 1, per_page: 10).map { _1 }

GET /api/v2/documents/:document_id/document_tokens



26
27
28
29
30
31
32
33
34
35
# File 'lib/doc_fox/document_token/list_service.rb', line 26

def initialize(document_id:, page: 1, per_page: Float::INFINITY)
  @document_id = document_id

  super(
    path:         "documents/#{document_id}/document_tokens",
    facade_klass: DocFox::DocumentToken::Facade,
    page:         page,
    per_page:     per_page
  )
end

Instance Attribute Details

#document_idObject (readonly)

Returns the value of attribute document_id.



6
7
8
# File 'lib/doc_fox/document_token/list_service.rb', line 6

def document_id
  @document_id
end