Class: HideAndSeek::ItemsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hide_and_seek/items_controller.rb

Instance Method Summary collapse

Instance Method Details

#hide_and_seekObject



25
26
27
# File 'app/controllers/hide_and_seek/items_controller.rb', line 25

def hide_and_seek
  @hide_and_seek ||= HideAndSeek::Item.new(params[:item_name], user_identifier)
end

#showObject



5
6
7
8
9
10
11
# File 'app/controllers/hide_and_seek/items_controller.rb', line 5

def show
  respond_to do |format|
    format.json {
      render json: [display: hide_and_seek.display?]
    }
  end
end

#updateObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/hide_and_seek/items_controller.rb', line 13

def update
  respond_to do |format|
    format.json do
      if hide_and_seek.hide
        render status: 200, json: [true]
      else
        render status: 502, json: [false]
      end
    end
  end
end