Class: PDNS::RecordsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- PDNS::RecordsController
- Defined in:
- app/controllers/pdns/records_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #force_update_records ⇒ Object
- #index ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/pdns/records_controller.rb', line 19 def create set_domain delete_records @record = @domain.records.create(record_params_without_id) if @record.save update_serial render json: @record, status: :created else render json: @record.errors, status: :unprocessable_entity end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/controllers/pdns/records_controller.rb', line 45 def destroy set_domain set_record @record.destroy update_serial head :no_content end |
#force_update_records ⇒ Object
54 55 56 57 58 59 60 |
# File 'app/controllers/pdns/records_controller.rb', line 54 def force_update_records set_domain type = params[:type] || 'A' @domain.records.where(type: type).update_all(record_params) render json: @domain.records.where(type: type), status: :ok end |
#index ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/pdns/records_controller.rb', line 5 def index set_domain set_records render json: @records, status: :ok end |
#show ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/pdns/records_controller.rb', line 12 def show set_domain set_record render json: @record, status: :ok end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/pdns/records_controller.rb', line 33 def update set_domain set_record if @record.update(record_params) update_serial render json: @record, status: :ok else render json: @record.errors, status: :unprocessable_entity end end |