Commit e93a8be9f4c1bfc67b40c338454281c3483612b4
1 parent
11b7bff4
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
API: Add environment endpoint
Showing
3 changed files
with
33 additions
and
1 deletions
Show diff stats
lib/noosfero/api/api.rb
... | ... | @@ -9,7 +9,7 @@ module Noosfero |
9 | 9 | |
10 | 10 | logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log")) |
11 | 11 | logger.formatter = GrapeLogging::Formatters::Default.new |
12 | - use RequestLogger, { logger: logger } | |
12 | + use GrapeLogging::Middleware::RequestLogger, { logger: logger } | |
13 | 13 | |
14 | 14 | rescue_from :all do |e| |
15 | 15 | logger.error e |
... | ... | @@ -45,6 +45,7 @@ module Noosfero |
45 | 45 | mount V1::Enterprises |
46 | 46 | mount V1::Categories |
47 | 47 | mount V1::Tasks |
48 | + mount V1::Environments | |
48 | 49 | mount Session |
49 | 50 | |
50 | 51 | # hook point which allow plugins to add Grape::API extensions to API::API | ... | ... |
lib/noosfero/api/entities.rb
... | ... | @@ -0,0 +1,27 @@ |
1 | +module Noosfero | |
2 | + module API | |
3 | + module V1 | |
4 | + class Environments < Grape::API | |
5 | + before { authenticate! } | |
6 | + | |
7 | + resource :environment do | |
8 | + | |
9 | + # Get environment object | |
10 | + # | |
11 | + # Example Request: | |
12 | + # GET /environment | |
13 | + get do | |
14 | + present environment, :with => Entities::Environment | |
15 | + end | |
16 | + | |
17 | + desc "Return the person information" | |
18 | + get '/signup_person_fields' do | |
19 | + present environment.signup_person_fields | |
20 | + end | |
21 | + | |
22 | + end | |
23 | + | |
24 | + end | |
25 | + end | |
26 | + end | |
27 | +end | ... | ... |