Class: ExportCsv::BaseService

Inherits:
Object
  • Object
show all
Defined in:
app/services/export_csv/base_service.rb

Constant Summary collapse

TARGET_FILESIZE =

Target attachment size before base64 encoding

15.megabytes

Instance Method Summary collapse

Constructor Details

#initialize(relation, resource_parent, 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, fields = [])
  @objects = relation
  @resource_parent = resource_parent
  @fields = fields
end

Instance Method Details

#csv_dataObject



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

Raises:

  • (NotImplementedError)


18
19
20
# File 'app/services/export_csv/base_service.rb', line 18

def email(user)
  raise NotImplementedError
end

#invalid_fieldsObject



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