Class: API::ItemsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/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 Sufia.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#itemObject (readonly)

Returns the value of attribute item.



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

def item
  @item
end

Instance Method Details

#createObject



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

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

#destroyObject



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

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

#showObject



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

def show
  head :no_content
end

#updateObject



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

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