Skip to content

Commit

Permalink
Document and test API with OpenAPI (reading)
Browse files Browse the repository at this point in the history
(OpenAPI used to be called Swagger)
  • Loading branch information
wvengen committed May 28, 2016
1 parent 281c12b commit 70ad025
Show file tree
Hide file tree
Showing 13 changed files with 716 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@ group :test do
# code coverage
gem 'simplecov', require: false
gem 'coveralls', require: false
# api
gem 'apivore', require: false
end
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ GEM
railties (>= 4.0)
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
Expand All @@ -74,6 +75,13 @@ GEM
acts_as_tree (2.4.0)
activerecord (>= 3.0.0)
addressable (2.4.0)
apivore (1.6.0)
actionpack (~> 4)
hashie (~> 3.3)
json-schema (~> 2.5)
rspec (~> 3)
rspec-expectations (~> 3.1)
rspec-mocks (~> 3.1)
arel (6.0.3)
attribute_normalizer (1.2.0)
base32 (0.3.2)
Expand Down Expand Up @@ -166,6 +174,8 @@ GEM
gaffe (1.1.0)
rails (>= 4.0.0)
git-version-bump (0.15.1)
globalid (0.3.6)
activesupport (>= 4.1.0)
haml (4.0.7)
tilt
haml-rails (0.9.0)
Expand All @@ -177,6 +187,7 @@ GEM
has_scope (0.6.0)
actionpack (>= 3.2, < 5)
activesupport (>= 3.2, < 5)
hashie (3.4.4)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
Expand All @@ -202,6 +213,8 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
json-schema (2.5.0)
addressable (~> 2.3)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -474,6 +487,7 @@ DEPENDENCIES
active_model_serializers (~> 0.10.0.rc4)
acts_as_tree
acts_as_versioned!
apivore
attribute_normalizer
better_errors
binding_of_caller
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/api/v1/article_categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ def index
render json: search_scope
end

def show
render json: scope.find(params.require(:id))
end

private

def max_per_page
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
resources :orders, only: [:index, :show]
resources :order_articles, only: [:index, :show]
resources :group_order_articles
resources :article_categories, only: [:index]
resources :article_categories, only: [:index, :show]
end
end

Expand Down
Loading

0 comments on commit 70ad025

Please sign in to comment.