Permalink
Browse files

first usable version with basic frontend

  • Loading branch information...
1 parent dd3ef1c commit 7dbefcf0ea85e80fa1f4a4dc7e25cfba004d7259 @Pajk Pajk committed Mar 30, 2012
Showing with 20,713 additions and 244 deletions.
  1. +1 −0 .rvmrc
  2. +2 −2 Gemfile
  3. +20 −35 Gemfile.lock
  4. +1 −1 MIT-LICENSE
  5. +0 −3 README.rdoc
  6. +40 −0 app/controllers/restapis_controller.rb
  7. +1,431 −0 app/public/javascripts/backbone.js
  8. +138 −0 app/public/javascripts/bootstrap-collapse.js
  9. +1,726 −0 app/public/javascripts/bootstrap.js
  10. +9,404 −0 app/public/javascripts/jquery-1.7.2.js
  11. +487 −0 app/public/javascripts/json2.js
  12. +3 −0 app/public/javascripts/restapi/collections/methods.js
  13. +4 −0 app/public/javascripts/restapi/collections/resources.js
  14. +49 −0 app/public/javascripts/restapi/jst.js
  15. +1 −0 app/public/javascripts/restapi/models/resource.js
  16. +17 −0 app/public/javascripts/restapi/restapi.js
  17. +34 −0 app/public/javascripts/restapi/routers/resources_router.js
  18. +14 −0 app/public/javascripts/restapi/views/resources/resources_index.js
  19. +14 −0 app/public/javascripts/restapi/views/resources/resources_show.js
  20. +999 −0 app/public/javascripts/underscore.js
  21. +686 −0 app/public/stylesheets/bootstrap-responsive.css
  22. +12 −0 app/public/stylesheets/bootstrap-responsive.min.css
  23. +3,990 −0 app/public/stylesheets/bootstrap.css
  24. +689 −0 app/public/stylesheets/bootstrap.min.css
  25. +7 −0 app/public/stylesheets/restapi/application.css
  26. +72 −0 app/views/restapis/index.html.erb
  27. +18 −4 lib/restapi.rb
  28. +0 −26 lib/restapi/api.rb
  29. +0 −86 lib/restapi/api_manager.rb
  30. +127 −7 lib/restapi/application.rb
  31. +38 −42 lib/restapi/dsl_definition.rb
  32. +15 −0 lib/restapi/error_description.rb
  33. +36 −0 lib/restapi/method_description.rb
  34. +43 −0 lib/restapi/param_description.rb
  35. +34 −0 lib/restapi/resource_description.rb
  36. +31 −10 lib/restapi/restapi_module.rb
  37. +23 −0 lib/restapi/routing.rb
  38. +157 −0 lib/restapi/validator.rb
  39. +1 −0 lib/restapi/version.rb
  40. +1 −1 restapi.gemspec
  41. +13 −0 spec/controllers/restapis_controller_spec.rb
  42. +110 −12 spec/controllers/users_controller_spec.rb
  43. +22 −0 spec/dummy/app/controllers/dogs_controller.rb
  44. +163 −5 spec/dummy/app/controllers/users_controller.rb
  45. +24 −0 spec/dummy/app/views/users/doc.html.erb
  46. +0 −1 spec/dummy/config/environments/development.rb
  47. +1 −1 spec/dummy/config/environments/production.rb
  48. +5 −0 spec/dummy/config/initializers/restapi.rb
  49. +9 −1 spec/dummy/config/routes.rb
  50. +1 −7 spec/spec_helper.rb
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use 1.8.7@restapi
View
@@ -10,5 +10,5 @@ group :development, :test do
end
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
-# gem 'ruby-debug'
-gem 'ruby-debug19'
+#gem 'ruby-debug'
+# gem 'ruby-debug19'
View
@@ -29,7 +29,6 @@ GEM
activemodel (= 3.0.11)
activesupport (= 3.0.11)
activesupport (3.0.11)
- archive-tar-minitar (0.5.2)
arel (2.0.10)
builder (2.1.2)
capybara (1.1.2)
@@ -39,17 +38,14 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
- childprocess (0.2.3)
+ childprocess (0.3.1)
ffi (~> 1.0.6)
- columnize (0.3.4)
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
ffi (1.0.11)
i18n (0.5.0)
- json (1.6.2)
- linecache19 (0.5.12)
- ruby_core_source (>= 0.1.4)
+ json (1.6.5)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -59,7 +55,7 @@ GEM
multi_json (1.0.4)
nokogiri (1.5.0)
polyglot (0.3.3)
- rack (1.2.4)
+ rack (1.2.5)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
@@ -79,38 +75,28 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.9.2.2)
- rdoc (3.11)
+ rdoc (3.12)
json (~> 1.4)
- rspec (2.7.0)
- rspec-core (~> 2.7.0)
- rspec-expectations (~> 2.7.0)
- rspec-mocks (~> 2.7.0)
- rspec-core (2.7.1)
- rspec-expectations (2.7.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.7.0)
- rspec-rails (2.7.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.7.0)
- ruby-debug-base19 (0.11.25)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby_core_source (>= 0.1.4)
- ruby-debug19 (0.11.6)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby-debug-base19 (>= 0.11.19)
- ruby_core_source (0.1.5)
- archive-tar-minitar (>= 0.5.2)
- rubyzip (0.9.5)
- selenium-webdriver (2.14.0)
- childprocess (>= 0.2.1)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ rubyzip (0.9.6.1)
+ selenium-webdriver (2.19.0)
+ childprocess (>= 0.2.5)
ffi (~> 1.0.9)
multi_json (~> 1.0.4)
rubyzip
- sqlite3 (1.3.4)
+ sqlite3 (1.3.5)
thor (0.14.6)
treetop (1.4.10)
polyglot
@@ -127,5 +113,4 @@ DEPENDENCIES
capybara (>= 0.4.0)
rails (= 3.0.11)
rspec-rails
- ruby-debug19
sqlite3
View
@@ -1,4 +1,4 @@
-Copyright 2011 YOURNAME
+Copyright 2012 Pavel Pokorný
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,3 +0,0 @@
-= Restapi
-
-This project rocks. Real readme comes before Christmass.
@@ -0,0 +1,40 @@
+class RestapisController < ActionController::Base
+ layout false
+
+ def index
+
+ respond_to do |format|
+
+ format.json do
+ # return methods description if resource given
+ if params[:resource].present?
+
+ # return app info
+ if params[:resource] == "api_info"
+
+ render :json => Restapi.info
+
+ else
+
+ keys = Restapi.resource_descriptions[params[:resource]]
+ render(:nothing => true) and return unless keys
+ keys = keys.methods
+ render(:nothing => true) and return unless keys
+ methods = []
+ keys.each { |key| methods << Restapi.method_descriptions[key].to_json }
+ render :json => methods
+
+ end
+ # return all resources if no resource given
+ else
+ render :json => Restapi.resource_descriptions.collect{ |_, v| v }
+ end
+
+ end
+
+ # render
+ format.html { render 'index' }
+ end
+ end
+
+end
Oops, something went wrong.

0 comments on commit 7dbefcf

Please sign in to comment.