Class: Api::V1::DomainsController
- Inherits:
-
ApiController
- Object
- ApiController
- Api::V1::DomainsController
show all
- Includes:
- DomainAuthorization
- Defined in:
- app/controllers/api/v1/domains_controller.rb
Instance Method Summary
collapse
#authorize_domain, #current_domain
Instance Method Details
#create ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'app/controllers/api/v1/domains_controller.rb', line 27
def create
@domain = Domain.new(host: params[:host], plan: params[:plan], provisional: true, user_users_id: current_user.id)
if @domain.save
render "show"
else
render json: @domain.errors, status: 418
end
end
|
#destroy ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/controllers/api/v1/domains_controller.rb', line 36
def destroy
@domain = Domain.find_by(host: params[:host])
@domain.destroy!
index
render "index"
end
|
#index ⇒ Object
13
14
15
16
17
18
|
# File 'app/controllers/api/v1/domains_controller.rb', line 13
def index
@domains = Domain.where(user_users_id: current_user.id)
if params[:records]
doorkeeper_authorize!(:domains_records)
end
end
|
#show ⇒ Object
20
21
22
23
24
25
|
# File 'app/controllers/api/v1/domains_controller.rb', line 20
def show
@domain = Domain.find_by(host: params[:host])
if params[:records]
doorkeeper_authorize!(:domains_records)
end
end
|