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.



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

def item
  @item
end

Instance Method Details

#createObject



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

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

#destroyObject



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

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

#showObject



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

def show
  head :no_content
end

#updateObject



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

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