Class: Hyrax::API::ItemsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/hyrax/api/items_controller.rb

Overview

Adds an endpoint that consumes and RESTfully emits JSON from Arkivo representing new and updated Zotero-managed publications. An item in the Zotero parlance is mapped to a work in Hyrax.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#itemObject (readonly)

Returns the value of attribute item.



13
14
15
# File 'app/controllers/hyrax/api/items_controller.rb', line 13

def item
  @item
end

Instance Method Details

#createObject



15
16
17
# File 'app/controllers/hyrax/api/items_controller.rb', line 15

def create
  head :created, location: hyrax.api_item_path(actor.create_work_from_item)
end

#destroyObject



24
25
26
27
# File 'app/controllers/hyrax/api/items_controller.rb', line 24

def destroy
  actor.destroy_work(@work)
  head :no_content
end

#showObject



29
30
31
# File 'app/controllers/hyrax/api/items_controller.rb', line 29

def show
  head :no_content
end

#updateObject



19
20
21
22
# File 'app/controllers/hyrax/api/items_controller.rb', line 19

def update
  actor.update_work_from_item(@work)
  head :no_content
end