Class: ExportCsv::BaseService
- Inherits:
-
Object
- Object
- ExportCsv::BaseService
- Defined in:
- app/services/export_csv/base_service.rb
Direct Known Subclasses
MapExportFieldsService, Issues::ExportCsvService, MergeRequests::ExportCsvService, WorkItems::ExportCsvService
Constant Summary collapse
- TARGET_FILESIZE =
Target attachment size before base64 encoding
15.megabytes
Instance Method Summary collapse
- #csv_data ⇒ Object
- #email(user) ⇒ Object
-
#initialize(relation, resource_parent = nil, fields = []) ⇒ BaseService
constructor
A new instance of BaseService.
- #invalid_fields ⇒ Object
Constructor Details
#initialize(relation, resource_parent = nil, fields = []) ⇒ BaseService
Returns a new instance of BaseService.
8 9 10 11 12 |
# File 'app/services/export_csv/base_service.rb', line 8 def initialize(relation, resource_parent = nil, fields = []) @objects = relation @resource_parent = resource_parent @fields = fields end |
Instance Method Details
#csv_data ⇒ Object
14 15 16 |
# File 'app/services/export_csv/base_service.rb', line 14 def csv_data csv_builder.render(TARGET_FILESIZE) end |
#email(user) ⇒ Object
18 19 20 |
# File 'app/services/export_csv/base_service.rb', line 18 def email(user) raise NotImplementedError end |
#invalid_fields ⇒ Object
22 23 24 |
# File 'app/services/export_csv/base_service.rb', line 22 def invalid_fields ::ExportCsv::MapExportFieldsService.new(fields, header_to_value_hash).invalid_fields end |