[API]注册接口完成

This commit is contained in:
guange 2014-12-07 10:48:05 +08:00
parent 91ea1adad3
commit db9eebbac7
2 changed files with 17 additions and 4 deletions

View File

@ -122,6 +122,7 @@ GEM
htmlentities (4.3.2)
i18n (0.6.1)
ice_nine (0.11.0)
iconv (1.0.4)
journey (1.0.4)
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
@ -171,6 +172,8 @@ GEM
win32console (~> 1.3)
pry-nav (0.2.3)
pry (~> 0.9.10)
puma (2.10.1)
rack (>= 1.1, < 2.0)
rack (1.4.5)
rack-accept (0.4.5)
rack (>= 0.4)
@ -219,6 +222,7 @@ GEM
sass-rails
rmagick (2.13.2)
ruby-openid (2.1.8)
ruby-prof (0.15.2)
rubyzip (1.1.6)
sass (3.3.10)
sass-rails (3.2.6)
@ -269,6 +273,8 @@ GEM
win32console (1.3.2-x86-mingw32)
xpath (2.0.0)
nokogiri (~> 1.3)
zip-zip (0.3)
rubyzip (>= 1.0.0)
PLATFORMS
ruby
@ -291,6 +297,7 @@ DEPENDENCIES
guard-test (~> 1.0.0)
htmlentities
i18n (~> 0.6.0)
iconv
jquery-rails (~> 2.0.2)
kaminari
mocha (~> 1.1.0)
@ -300,12 +307,15 @@ DEPENDENCIES
paperclip (~> 3.5.4)
pry
pry-nav
puma
rack-mini-profiler!
rack-openid
rails (= 3.2.13)
rich (= 1.4.6)
rmagick (>= 2.0.0)
ruby-openid (~> 2.1.4)
ruby-prof (~> 0.15.1)
rubyzip
sass-rails (~> 3.2.3)
seems_rateable!
selenium-webdriver (~> 2.42.0)
@ -313,3 +323,4 @@ DEPENDENCIES
spork-testunit (~> 0.0.8)
therubyracer
uglifier (>= 1.0.3)
zip-zip

View File

@ -9,15 +9,17 @@ module Mobile
desc "add a user"
params do
requires :login, type: String, desc: 'username'
requires :email, type: String, desc: 'email'
requires :mail, type: String, desc: 'mail'
requires :password, type: String, desc: 'password'
end
post do
user_service = UsersService.new
us = UsersService.new
begin
user = user_service.register(params)
user = us.register params.merge(:password_confirmation => params[:password],
:should_confirmation_password => true)
raise "register failed." if user.new_record?
{status: 0, data: user}
rescue Exception => e
rescue => e
{status: 1, message: e.message}
end
end