[API]注册接口完成
This commit is contained in:
parent
91ea1adad3
commit
db9eebbac7
11
Gemfile.lock
11
Gemfile.lock
|
@ -122,6 +122,7 @@ GEM
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.2)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
ice_nine (0.11.0)
|
ice_nine (0.11.0)
|
||||||
|
iconv (1.0.4)
|
||||||
journey (1.0.4)
|
journey (1.0.4)
|
||||||
jquery-rails (2.0.3)
|
jquery-rails (2.0.3)
|
||||||
railties (>= 3.1.0, < 5.0)
|
railties (>= 3.1.0, < 5.0)
|
||||||
|
@ -171,6 +172,8 @@ GEM
|
||||||
win32console (~> 1.3)
|
win32console (~> 1.3)
|
||||||
pry-nav (0.2.3)
|
pry-nav (0.2.3)
|
||||||
pry (~> 0.9.10)
|
pry (~> 0.9.10)
|
||||||
|
puma (2.10.1)
|
||||||
|
rack (>= 1.1, < 2.0)
|
||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
|
@ -219,6 +222,7 @@ GEM
|
||||||
sass-rails
|
sass-rails
|
||||||
rmagick (2.13.2)
|
rmagick (2.13.2)
|
||||||
ruby-openid (2.1.8)
|
ruby-openid (2.1.8)
|
||||||
|
ruby-prof (0.15.2)
|
||||||
rubyzip (1.1.6)
|
rubyzip (1.1.6)
|
||||||
sass (3.3.10)
|
sass (3.3.10)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
|
@ -269,6 +273,8 @@ GEM
|
||||||
win32console (1.3.2-x86-mingw32)
|
win32console (1.3.2-x86-mingw32)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
zip-zip (0.3)
|
||||||
|
rubyzip (>= 1.0.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -291,6 +297,7 @@ DEPENDENCIES
|
||||||
guard-test (~> 1.0.0)
|
guard-test (~> 1.0.0)
|
||||||
htmlentities
|
htmlentities
|
||||||
i18n (~> 0.6.0)
|
i18n (~> 0.6.0)
|
||||||
|
iconv
|
||||||
jquery-rails (~> 2.0.2)
|
jquery-rails (~> 2.0.2)
|
||||||
kaminari
|
kaminari
|
||||||
mocha (~> 1.1.0)
|
mocha (~> 1.1.0)
|
||||||
|
@ -300,12 +307,15 @@ DEPENDENCIES
|
||||||
paperclip (~> 3.5.4)
|
paperclip (~> 3.5.4)
|
||||||
pry
|
pry
|
||||||
pry-nav
|
pry-nav
|
||||||
|
puma
|
||||||
rack-mini-profiler!
|
rack-mini-profiler!
|
||||||
rack-openid
|
rack-openid
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rich (= 1.4.6)
|
rich (= 1.4.6)
|
||||||
rmagick (>= 2.0.0)
|
rmagick (>= 2.0.0)
|
||||||
ruby-openid (~> 2.1.4)
|
ruby-openid (~> 2.1.4)
|
||||||
|
ruby-prof (~> 0.15.1)
|
||||||
|
rubyzip
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
seems_rateable!
|
seems_rateable!
|
||||||
selenium-webdriver (~> 2.42.0)
|
selenium-webdriver (~> 2.42.0)
|
||||||
|
@ -313,3 +323,4 @@ DEPENDENCIES
|
||||||
spork-testunit (~> 0.0.8)
|
spork-testunit (~> 0.0.8)
|
||||||
therubyracer
|
therubyracer
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
|
zip-zip
|
||||||
|
|
|
@ -9,15 +9,17 @@ module Mobile
|
||||||
desc "add a user"
|
desc "add a user"
|
||||||
params do
|
params do
|
||||||
requires :login, type: String, desc: 'username'
|
requires :login, type: String, desc: 'username'
|
||||||
requires :email, type: String, desc: 'email'
|
requires :mail, type: String, desc: 'mail'
|
||||||
requires :password, type: String, desc: 'password'
|
requires :password, type: String, desc: 'password'
|
||||||
end
|
end
|
||||||
post do
|
post do
|
||||||
user_service = UsersService.new
|
us = UsersService.new
|
||||||
begin
|
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}
|
{status: 0, data: user}
|
||||||
rescue Exception => e
|
rescue => e
|
||||||
{status: 1, message: e.message}
|
{status: 1, message: e.message}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue