Class: ToSpotlight::SpotlightTransferController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ToSpotlight::SpotlightTransferController
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- app/controllers/to_spotlight/spotlight_transfer_controller.rb
Instance Method Summary collapse
Instance Method Details
#api ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/to_spotlight/spotlight_transfer_controller.rb', line 13 def api case params[:request_type] when 'fields' render plain: curated_fields when 'works' render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: 'work', data: curated_works } when 'collections' render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: 'collection', data: collections } else render plain: 'Invalid Request Type' end end |
#approve ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/to_spotlight/spotlight_transfer_controller.rb', line 42 def approve now = params[:commit].downcase.include?('now') transfer = ToSpotlight::SpotlightTransfer.find params[:transfer_id] works = ::ActiveFedora::Base.where member_of_collection_ids_ssim: transfer.collection_id mappings = mapping_invert transfer.mappings if now SpotlightTransferJob.perform_later(works.to_a, mappings, transfer) else SpotlightTransferJob.set(wait_until: Date.today.end_of_day) .perform_later(works.to_a, mappings, transfer) end end |
#index ⇒ Object
38 39 40 |
# File 'app/controllers/to_spotlight/spotlight_transfer_controller.rb', line 38 def index @transfers = ToSpotlight::SpotlightTransfer.all end |
#receive ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/to_spotlight/spotlight_transfer_controller.rb', line 27 def receive return unless params[:token] == token @transfer = ToSpotlight::SpotlightTransfer.new get_transfer_attributes @transfer.mappings = params[:mappings] if @transfer.save render plain: 'Transfer Request Received' else render plain: 'Transfer Request Failed' end end |