Class: FormToResourceService
- Inherits:
-
Object
- Object
- FormToResourceService
- Defined in:
- app/services/form_to_resource_service.rb
Class Method Summary collapse
-
.convert(params, work) ⇒ PDCMetadata::Resource
Convert params into a resource.
Class Method Details
.convert(params, work) ⇒ PDCMetadata::Resource
Convert params into a resource
@param [Hash] params controller params to be converted
@param [Work] work params will be applied to. Utilizes the work for old values if needed.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/form_to_resource_service.rb', line 11 def convert(params, work) resource = reset_resource_to_work(work) resource.description = params["description"] resource.publisher = params["publisher"] if params["publisher"].present? resource.publication_year = params["publication_year"] if params["publication_year"].present? resource.keywords = (params["keywords"] || "").split(",").map(&:strip) add_rights(params, resource) (params, resource) add_curator_controlled(params, resource) add_titles(params, resource) (params, resource) add_creators(params, resource) add_individual_contributors(params, resource) add_organizational_contributors(params, resource) add_funders(params, resource) resource end |