Class: Orchestrator::Api::ZonesController

Inherits:
Orchestrator::ApiController show all
Defined in:
app/controllers/orchestrator/api/zones_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 29

def create
    zone = Zone.new(safe_params)
    save_and_respond zone
end

#destroyObject



34
35
36
37
38
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 34

def destroy
    # delete will update CS and zone caches
    @zone.delete
    render :nothing => true
end

#indexObject



13
14
15
16
17
18
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 13

def index
    query = @@elastic.query(params)
    query.sort = [{name: "asc"}]

    respond_with @@elastic.search(query)
end

#showObject



20
21
22
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 20

def show
    respond_with @zone
end

#updateObject



24
25
26
27
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 24

def update
    @zone.update_attributes(safe_params)
    save_and_respond @zone
end