Skip to content
Snippets Groups Projects
Commit 57e8c4d1 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

server api

parent 67befe86
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,4 @@ class Api::Osuny::Communication::WebsitesController < Api::ApplicationController
@websites = current_university.communication_websites.in_production
end
def theme_released
render_forbidden unless params[:secret_key].present? && params[:secret_key] == ENV['OSUNY_API_AUTOUPDATE_THEME_KEY']
Communication::Website.with_automatic_update.find_each do |website|
website.update_theme_version
end
end
end
class Api::Osuny::CommunicationController < Api::ApplicationController
def index
@websites = current_university.communication_websites.in_production
end
end
class Api::Osuny::Server::WebsitesController < Api::ApplicationController
def index
@websites = Communication::Website.in_production
end
def theme_released
render_forbidden unless params[:secret_key].present? && params[:secret_key] == ENV['OSUNY_API_AUTOUPDATE_THEME_KEY']
Communication::Website.with_automatic_update.find_each do |website|
website.update_theme_version
end
end
end
class Api::Osuny::ServerController < Api::ApplicationController
def index
@websites = current_university.communication_websites.in_production
end
end
class Api::OsunyController < Api::ApplicationController
def index
@websites = current_university.communication_websites.in_production
end
end
......@@ -7,7 +7,7 @@
L'API Osuny permet d'interagir avec une instance.
L'implémentation est très rudimentaire, n'hésitez pas à ouvrir <a href="https://github.com/noesya/osuny/issues" target="_blank" rel="noreferrer">une issue sur Github</a> pour signaler un manque.
</p>
<%= link_to 'API', api_osuny_root_path, class: 'btn btn-primary' %>
<%= link_to 'API', api_osuny_path, class: 'btn btn-primary' %>
</div>
<div class="col-lg-6 mb-5">
<h2>LHÉO</h2>
......
json.communication do
json.url api_osuny_communication_path
end
json.server do
json.url api_osuny_server_path
end
json.websites do
json.url api_osuny_server_websites_path
end
json.array! @websites.each do |website|
json.name website.name
json.url website.url
end
......@@ -5,6 +5,10 @@ namespace :api do
get 'communication' => 'communication#index'
namespace :communication do
get 'websites' => 'websites#index'
end
get 'server' => 'server#index'
namespace :server do
get 'websites' => 'websites#index'
post 'websites/theme-released' => 'websites#theme_released'
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment