Class: Locomotive::Api::CurrentSiteController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Locomotive::Api::CurrentSiteController
show all
- Defined in:
- app/controllers/locomotive/api/current_site_controller.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks
Class Method Details
.description ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/locomotive/api/current_site_controller.rb', line 26
def self.description
{
overall: %{Manage the current site related to the domain name used to make the API call},
actions: {
show: {
description: %{Return the attributes of the current site},
response: Locomotive::SitePresenter.getters_to_hash,
example: {
command: %{curl 'http://mysite.com/locomotive/api/tokens.json'},
response: %(TODO)
}
},
update: {
description: %{Update the current site},
params: Locomotive::SitePresenter.setters_to_hash,
example: {
command: %{curl -d '...' -X UPDATE 'http://mysite.com/locomotive/api/current_site.json?auth_token=dtsjkqs1TJrWiSiJt2gg'},
response: %(TODO)
}
},
destroy: {
description: %{Delete the current site},
example: {
command: %{curl -X DELETE 'http://mysite.com/locomotive/api/current_site.json?auth_token=dtsjkqs1TJrWiSiJt2gg'},
response: %(TODO)
}
}
}
}
end
|
Instance Method Details
#destroy ⇒ Object
19
20
21
22
23
24
|
# File 'app/controllers/locomotive/api/current_site_controller.rb', line 19
def destroy
@site = current_site
authorize! :destroy, @site
@site.destroy
respond_with(@site)
end
|
#show ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/locomotive/api/current_site_controller.rb', line 5
def show
@site = current_site
authorize! :show, @site
respond_with(@site)
end
|
#update ⇒ Object
11
12
13
14
15
16
17
|
# File 'app/controllers/locomotive/api/current_site_controller.rb', line 11
def update
@site = current_site
authorize! :update, @site
@site.from_presenter(params[:site])
@site.save
respond_with(@site)
end
|