Class: LocationConverter
- Inherits:
-
Converter
show all
- Defined in:
- backend/app/converters/location_converter.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Converter
for, #get_output_path, #import_options, import_options, inherited, #initialize, list_import_types, register_converter, #remove_files, #run
Constructor Details
This class inherits a constructor from Converter
Class Method Details
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
|
# File 'backend/app/converters/location_converter.rb', line 25
def self.configure
{
'location_building' => 'location.building',
'location_floor' => 'location.floor',
'location_room' => 'location.room',
'location_area' => 'location.area',
'location_barcode' => 'location.barcode',
'location_classification' => 'location.classification',
'location_coordinate_1_label' => 'location.coordinate_1_label',
'location_coordinate_1_indicator' => 'location.coordinate_1_indicator',
'location_coordinate_2_label' => 'location.coordinate_2_label',
'location_coordinate_2_indicator' => 'location.coordinate_2_indicator',
'location_coordinate_3_label' => 'location.coordinate_3_label',
'location_coordinate_3_indicator' => 'location.coordinate_3_indicator',
'location_temporary' => 'location.temporary',
:location => {
:on_create => Proc.new {|data, obj|
if @import_options && @import_options[:import_repository]
obj.owner_repo = {'ref' => JSONModel(:repository).uri_for(Thread.current[:request_context][:repo_id])}
end
}
},
}
end
|
.import_types(show_hidden = false) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'backend/app/converters/location_converter.rb', line 7
def self.import_types(show_hidden = false)
[
{
name: 'location_csv',
description: 'Import Location records from a CSV file',
}
]
end
|
.instance_for(type, input_file) ⇒ Object
16
17
18
19
|
# File 'backend/app/converters/location_converter.rb', line 16
def self.instance_for(type, input_file)
@import_options = {}
new(input_file) if type == 'location_csv'
end
|
Instance Method Details
#set_import_options(opts) ⇒ Object
21
22
23
|
# File 'backend/app/converters/location_converter.rb', line 21
def set_import_options(opts)
self.import_options&.merge!(opts)
end
|