Class: ConnectorsSdk::Confluence::Extractor
- Inherits:
-
Base::Extractor
- Object
- Base::Extractor
- ConnectorsSdk::Confluence::Extractor
- Defined in:
- lib/connectors_sdk/confluence/extractor.rb
Direct Known Subclasses
Constant Summary collapse
- CONTENT_OFFSET_CURSOR_KEY =
'content'
- CONTENT_NEXT_CURSOR_KEY =
'next'
- CONTENT_MODIFIED_SINCE_NEXT_CURSOR_KEY =
'modified_since_next'
- CONTENT_MODIFIED_SINCE_CURSOR_KEY =
'content_modified_at'
Constants inherited from Base::Extractor
Base::Extractor::DEFAULT_CURSOR_KEY, Base::Extractor::MAX_CONNECTION_ATTEMPTS, Base::Extractor::TRANSIENT_SERVER_ERROR_CLASSES
Instance Attribute Summary
Attributes inherited from Base::Extractor
#client_proc, #completed, #config, #content_source_id, #features, #monitor, #original_cursors, #service_type
Instance Method Summary collapse
- #download(item) ⇒ Object
- #yield_deleted_ids(ids) ⇒ Object
- #yield_document_changes(modified_since: nil) ⇒ Object
Methods inherited from Base::Extractor
#authorization_data, #authorization_data!, #client, #client!, #convert_transient_server_errors, #cursors_modified_since_start?, #deleted_ids, #document_changes, #download_args_and_proc, #evictable?, #identifying_error_message, #initialize, #permissions, #retrieve_latest_cursors, #transient_error?, #with_auth_tokens_and_retry, #yield_permissions, #yield_single_document_change
Constructor Details
This class inherits a constructor from ConnectorsSdk::Base::Extractor
Instance Method Details
#download(item) ⇒ Object
77 78 79 80 |
# File 'lib/connectors_sdk/confluence/extractor.rb', line 77 def download(item) content = item[:content] client.download("#{content._links.base}#{content._links.download}").body end |
#yield_deleted_ids(ids) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/connectors_sdk/confluence/extractor.rb', line 56 def yield_deleted_ids(ids) id_groups = ids.group_by do |id| if Confluence::Adapter.es_id_is_confluence_space_id?(id) :space elsif Confluence::Adapter.es_id_is_confluence_content_id?(id) :content elsif Confluence::Adapter.(id) :attachment else :unknown end end %i(space content attachment).each do |group| confluence_ids = Array(id_groups[group]).map { |id| Confluence::Adapter.public_send("es_id_to_confluence_#{group}_id", id) } get_ids_for_deleted(confluence_ids, group).each do |deleted_id| yield Confluence::Adapter.public_send("confluence_#{group}_id_to_es_id", deleted_id) end end end |
#yield_document_changes(modified_since: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/connectors_sdk/confluence/extractor.rb', line 23 def yield_document_changes(modified_since: nil) @space_permissions_cache = {} @content_restriction_cache = {} yield_spaces do |space| yield_single_document_change(:identifier => "Confluence Space: #{space&.fetch(:key)} (#{space&.webui})") do = config. ? (space) : [] yield :create_or_update, Confluence::Adapter.es_document_from_confluence_space(space, content_base_url, ) end yield_content_for_space( :space => space[:key], :types => %w(page blogpost attachment), :modified_since => modified_since ) do |content| restrictions = config. ? get_content_restrictions(content) : [] if content.type == 'attachment' document = Confluence::Adapter.(content, content_base_url, restrictions) download_args = download_args_and_proc( id: document.fetch(:id), name: content.title, size: content.extensions.fileSize, download_args: { content: content } ) do |args| download(args) end yield :create_or_update, document, download_args else yield :create_or_update, Confluence::Adapter.es_document_from_confluence_content(content, content_base_url, restrictions) end end end end |