Class: Api::V1::Domains::RecordsController
- Inherits:
-
ApiController
- Object
- ApiController
- Api::V1::Domains::RecordsController
show all
- Includes:
- DomainAuthorization
- Defined in:
- app/controllers/api/v1/domains/records_controller.rb
Instance Method Summary
collapse
#authorize_domain, #current_domain
Instance Method Details
#create ⇒ Object
16
17
18
19
|
# File 'app/controllers/api/v1/domains/records_controller.rb', line 16
def create
@record = Record.create(domain_id: current_domain.id, name: params["name"], type: params["type"], content: params["content"], ttl: params["ttl"], priority: params["priority"]) render "show"
end
|
#destroy ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'app/controllers/api/v1/domains/records_controller.rb', line 39
def destroy
@record = Record.find(params[:id])
@record.destroy!
index
render "index"
end
|
#index ⇒ Object
12
13
14
|
# File 'app/controllers/api/v1/domains/records_controller.rb', line 12
def index
@records = current_domain.records
end
|
#show ⇒ Object
21
22
23
|
# File 'app/controllers/api/v1/domains/records_controller.rb', line 21
def show
@record = Record.find(params[:id])
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/api/v1/domains/records_controller.rb', line 25
def update
@record = Record.find(params[:id])
(@record.type = params[:type]) if params[:type]
(@record.name = params[:name]) if params[:name]
(@record.content = params[:content]) if params[:content]
(@record.ttl = params[:ttl]) if params[:ttl]
(@record.priority = params[:priority]) if params[:priority]
@record.save
render "show"
end
|