* Add sigs and docs to transformers * Add sigs and docs to downloaders * Adds sigs and docs to importers
80 lines
2.4 KiB
Text
80 lines
2.4 KiB
Text
module Granblue
|
|
module Importers
|
|
class BaseImporter
|
|
attr_reader new_records: Hash[String, Array[Hash[Symbol, untyped]]]
|
|
attr_reader updated_records: Hash[String, Array[Hash[Symbol, untyped]]]
|
|
|
|
def initialize: (
|
|
String file_path,
|
|
?test_mode: bool,
|
|
?verbose: bool,
|
|
?logger: untyped
|
|
) -> void
|
|
|
|
def import: -> Hash[Symbol, Hash[String, Array[Hash[Symbol, untyped]]]]
|
|
|
|
def simulate_import: -> Hash[Symbol, Hash[String, Array[Hash[Symbol, untyped]]]]
|
|
|
|
private
|
|
|
|
def import_row: (CSV::Row row) -> void
|
|
|
|
def find_or_create_record: (Hash[Symbol, untyped] attributes) -> [untyped, bool]?
|
|
|
|
def simulate_create: (
|
|
Hash[Symbol, untyped] attributes,
|
|
Hash[String, Array[Hash[Symbol, untyped]]] simulated_new,
|
|
String type
|
|
) -> void
|
|
|
|
def simulate_update: (
|
|
untyped existing_record,
|
|
Hash[Symbol, untyped] attributes,
|
|
Hash[String, Array[Hash[Symbol, untyped]]] simulated_updated,
|
|
String type
|
|
) -> void
|
|
|
|
def validate_required_attributes: (Hash[Symbol, untyped] attributes) -> void
|
|
|
|
def validate_update_attributes: (Hash[Symbol, untyped] update_attributes) -> void
|
|
|
|
def validate_record: (untyped record) -> void
|
|
|
|
def track_record: ([untyped, bool] result) -> void
|
|
|
|
def format_attributes: (Hash[Symbol, untyped] attributes) -> String
|
|
|
|
def log_test_update: (untyped record, Hash[Symbol, untyped] attributes) -> void
|
|
|
|
def log_test_creation: (Hash[Symbol, untyped] attributes) -> void
|
|
|
|
def log_new_record: (untyped record) -> void
|
|
|
|
def log_updated_record: (untyped record) -> void
|
|
|
|
def parse_value: (String? value) -> String?
|
|
|
|
def parse_integer: (String? value) -> Integer?
|
|
|
|
def parse_float: (String? value) -> Float?
|
|
|
|
def parse_boolean: (String? value) -> bool?
|
|
|
|
def parse_date: (String? date_str) -> Date?
|
|
|
|
def parse_array: (String? array_str) -> Array[String]
|
|
|
|
def parse_integer_array: (String? array_str) -> Array[Integer]
|
|
|
|
def model_class: -> singleton(ActiveRecord::Base)
|
|
|
|
def build_attributes: (CSV::Row row) -> Hash[Symbol, untyped]
|
|
|
|
def handle_error: (StandardError error) -> void
|
|
|
|
def format_validation_error: (ActiveRecord::RecordInvalid error) -> String
|
|
|
|
def format_standard_error: (StandardError error) -> String
|
|
end
|
|
end
|
|
end
|