Skip to content

Commit 7dbefcf

Browse files
committed
first usable version with basic frontend
1 parent dd3ef1c commit 7dbefcf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+20713
-244
lines changed

.rvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rvm use 1.8.7@restapi

Gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ group :development, :test do
1010
end
1111

1212
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
13-
# gem 'ruby-debug'
14-
gem 'ruby-debug19'
13+
#gem 'ruby-debug'
14+
# gem 'ruby-debug19'

Gemfile.lock

+20-35
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ GEM
2929
activemodel (= 3.0.11)
3030
activesupport (= 3.0.11)
3131
activesupport (3.0.11)
32-
archive-tar-minitar (0.5.2)
3332
arel (2.0.10)
3433
builder (2.1.2)
3534
capybara (1.1.2)
@@ -39,17 +38,14 @@ GEM
3938
rack-test (>= 0.5.4)
4039
selenium-webdriver (~> 2.0)
4140
xpath (~> 0.1.4)
42-
childprocess (0.2.3)
41+
childprocess (0.3.1)
4342
ffi (~> 1.0.6)
44-
columnize (0.3.4)
4543
diff-lcs (1.1.3)
4644
erubis (2.6.6)
4745
abstract (>= 1.0.0)
4846
ffi (1.0.11)
4947
i18n (0.5.0)
50-
json (1.6.2)
51-
linecache19 (0.5.12)
52-
ruby_core_source (>= 0.1.4)
48+
json (1.6.5)
5349
mail (2.2.19)
5450
activesupport (>= 2.3.6)
5551
i18n (>= 0.4.0)
@@ -59,7 +55,7 @@ GEM
5955
multi_json (1.0.4)
6056
nokogiri (1.5.0)
6157
polyglot (0.3.3)
62-
rack (1.2.4)
58+
rack (1.2.5)
6359
rack-mount (0.6.14)
6460
rack (>= 1.0.0)
6561
rack-test (0.5.7)
@@ -79,38 +75,28 @@ GEM
7975
rdoc (~> 3.4)
8076
thor (~> 0.14.4)
8177
rake (0.9.2.2)
82-
rdoc (3.11)
78+
rdoc (3.12)
8379
json (~> 1.4)
84-
rspec (2.7.0)
85-
rspec-core (~> 2.7.0)
86-
rspec-expectations (~> 2.7.0)
87-
rspec-mocks (~> 2.7.0)
88-
rspec-core (2.7.1)
89-
rspec-expectations (2.7.0)
80+
rspec (2.8.0)
81+
rspec-core (~> 2.8.0)
82+
rspec-expectations (~> 2.8.0)
83+
rspec-mocks (~> 2.8.0)
84+
rspec-core (2.8.0)
85+
rspec-expectations (2.8.0)
9086
diff-lcs (~> 1.1.2)
91-
rspec-mocks (2.7.0)
92-
rspec-rails (2.7.0)
93-
actionpack (~> 3.0)
94-
activesupport (~> 3.0)
95-
railties (~> 3.0)
96-
rspec (~> 2.7.0)
97-
ruby-debug-base19 (0.11.25)
98-
columnize (>= 0.3.1)
99-
linecache19 (>= 0.5.11)
100-
ruby_core_source (>= 0.1.4)
101-
ruby-debug19 (0.11.6)
102-
columnize (>= 0.3.1)
103-
linecache19 (>= 0.5.11)
104-
ruby-debug-base19 (>= 0.11.19)
105-
ruby_core_source (0.1.5)
106-
archive-tar-minitar (>= 0.5.2)
107-
rubyzip (0.9.5)
108-
selenium-webdriver (2.14.0)
109-
childprocess (>= 0.2.1)
87+
rspec-mocks (2.8.0)
88+
rspec-rails (2.8.1)
89+
actionpack (>= 3.0)
90+
activesupport (>= 3.0)
91+
railties (>= 3.0)
92+
rspec (~> 2.8.0)
93+
rubyzip (0.9.6.1)
94+
selenium-webdriver (2.19.0)
95+
childprocess (>= 0.2.5)
11096
ffi (~> 1.0.9)
11197
multi_json (~> 1.0.4)
11298
rubyzip
113-
sqlite3 (1.3.4)
99+
sqlite3 (1.3.5)
114100
thor (0.14.6)
115101
treetop (1.4.10)
116102
polyglot
@@ -127,5 +113,4 @@ DEPENDENCIES
127113
capybara (>= 0.4.0)
128114
rails (= 3.0.11)
129115
rspec-rails
130-
ruby-debug19
131116
sqlite3

MIT-LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2011 YOURNAME
1+
Copyright 2012 Pavel Pokorný
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.rdoc

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
= Restapi
2-
3-
This project rocks. Real readme comes before Christmass.
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class RestapisController < ActionController::Base
2+
layout false
3+
4+
def index
5+
6+
respond_to do |format|
7+
8+
format.json do
9+
# return methods description if resource given
10+
if params[:resource].present?
11+
12+
# return app info
13+
if params[:resource] == "api_info"
14+
15+
render :json => Restapi.info
16+
17+
else
18+
19+
keys = Restapi.resource_descriptions[params[:resource]]
20+
render(:nothing => true) and return unless keys
21+
keys = keys.methods
22+
render(:nothing => true) and return unless keys
23+
methods = []
24+
keys.each { |key| methods << Restapi.method_descriptions[key].to_json }
25+
render :json => methods
26+
27+
end
28+
# return all resources if no resource given
29+
else
30+
render :json => Restapi.resource_descriptions.collect{ |_, v| v }
31+
end
32+
33+
end
34+
35+
# render
36+
format.html { render 'index' }
37+
end
38+
end
39+
40+
end

0 commit comments

Comments
 (0)