Class: FromHyraxController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- FromHyraxController
- Defined in:
- app/controllers/from_hyrax_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/from_hyrax_controller.rb', line 27 def create return unless instances.include? params[:repo] # go to: to_spotlight/receive @mappings = params[:transfer][:mappings].permit!.to_h.map { |_, v| v unless v['spotlight']['0'].empty? }.compact #use hash.values = { transfer: params[:transfer], mappings: @mappings, token: token } @res = post_response URI("#{params[:repo]}/to_spotlight/receive"), end |
#hyrax_api ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/from_hyrax_controller.rb', line 9 def hyrax_api return nil unless instances.include?(params[:repo]) uri = URI("#{params[:repo]}/to_spotlight/api/#{params[:api_type]}") response = get_response(uri) render html: response.body.html_safe end |
#index ⇒ Object
16 17 18 |
# File 'app/controllers/from_hyrax_controller.rb', line 16 def index instances end |
#new ⇒ Object
20 21 22 23 24 25 |
# File 'app/controllers/from_hyrax_controller.rb', line 20 def new uri = URI("#{params[:repo]}/to_spotlight/api/fields") response = get_response(uri) @hyrax_fields = eval(response.body) @spotlight_fields = spotlight_fields.map { |f| [f[:label], f[:field_name]] } end |
#receive ⇒ Object
35 36 37 38 |
# File 'app/controllers/from_hyrax_controller.rb', line 35 def receive return unless params[:token] == token FromHyrax::RunImportJob.perform_later(params[:csv_url], csv_params) end |