* Move app/helpers/granblue_wiki to lib/parsers/wiki This clears up the namespace beginning with "Granblue" * Removed some top-level Granblue libs DataImporter and DownloadManager exist inside of the PostDeployment namespace now so these files are redundant * Fix Downloaders namespace Our namespace was singular Downloader, now it is plural Downloaders to match the folder name * Fix import paths * DownloadManager was moved to downloaders/ * import_data task now uses the PostDeployment version of DataImporter * Update application.rb Eager-Load/Autoload the lib/ folder * Update cors.rb Add Granblue website and Extension ID to CORS * Add transformers Transformers take raw data from Granblue Fantasy and transforms them into hensei-compatible JSON. Transformers heavily borrow from vazkii/hensei-transfer. * Add ImportController and route This adds the controller that handles creating a full party from transformed Granblue Fantasy data
39 lines
649 B
Ruby
39 lines
649 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Granblue
|
|
module Parsers
|
|
class ValidationErrorSerializer
|
|
def initialize(record, field, details)
|
|
@record = record
|
|
@field = field
|
|
@details = details
|
|
end
|
|
|
|
def serialize
|
|
{
|
|
resource: resource,
|
|
field: field,
|
|
code: code
|
|
}
|
|
end
|
|
|
|
private
|
|
|
|
def resource
|
|
@record.class.to_s
|
|
end
|
|
|
|
def field
|
|
@field.to_s
|
|
end
|
|
|
|
def code
|
|
@details[:error].to_s
|
|
end
|
|
|
|
def underscored_resource_name
|
|
@record.class.to_s.gsub('::', '').underscore
|
|
end
|
|
end
|
|
end
|
|
end
|