Commit 189246a317b32df162261d93b5109e98c44aa6fe
Committed by
Hugo Melo

1 parent
4b4ea91d
Exists in
master
and in
1 other branch
Adding badges endpoint and autentication for my bedges and levels
Showing
1 changed file
with
13 additions
and
7 deletions
Show diff stats
lib/gamification_plugin/api.rb
@@ -2,15 +2,21 @@ class GamificationPlugin::API < Grape::API | @@ -2,15 +2,21 @@ class GamificationPlugin::API < Grape::API | ||
2 | 2 | ||
3 | resource :gamification_plugin do | 3 | resource :gamification_plugin do |
4 | 4 | ||
5 | - resource :my do | ||
6 | - get 'badges' do | ||
7 | - present current_person.badges | ||
8 | - end | ||
9 | - get 'level' do | ||
10 | - {:level => current_person.level, :percent => current_person.gamification_plugin_level_percent} | ||
11 | - end | 5 | + get 'badges' do |
6 | + environment.gamification_plugin_badges.group(:name).count | ||
7 | + end | ||
8 | + | ||
9 | + resource :my do | ||
10 | + get 'badges' do | ||
11 | + authenticate! | ||
12 | + present current_person.badges | ||
13 | + end | ||
12 | 14 | ||
15 | + get 'level' do | ||
16 | + authenticate! | ||
17 | + {:level => current_person.level, :percent => current_person.gamification_plugin_level_percent} | ||
13 | end | 18 | end |
19 | + end | ||
14 | 20 | ||
15 | resource :people do | 21 | resource :people do |
16 | get ':id/badges' do | 22 | get ':id/badges' do |