Class: BulkImports::TreeExportService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/bulk_imports/tree_export_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(portable, export_path, relation, user) ⇒ TreeExportService

Returns a new instance of TreeExportService.



9
10
11
12
13
14
15
# File 'app/services/bulk_imports/tree_export_service.rb', line 9

def initialize(portable, export_path, relation, user)
  @portable = portable
  @export_path = export_path
  @relation = relation
  @config = FileTransfer.config_for(portable)
  @user = user
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
# File 'app/services/bulk_imports/tree_export_service.rb', line 17

def execute
  if self_relation?(relation)
    serializer.serialize_root(config.class::SELF_RELATION)
  else
    serializer.serialize_relation(relation_definition)
  end
end

#export_batch(ids) ⇒ Object



25
26
27
# File 'app/services/bulk_imports/tree_export_service.rb', line 25

def export_batch(ids)
  serializer.serialize_relation(relation_definition, batch_ids: Array.wrap(ids))
end

#exported_filenameObject



29
30
31
# File 'app/services/bulk_imports/tree_export_service.rb', line 29

def exported_filename
  "#{relation}.#{extension}"
end