api_canon 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7713a7d796315160feca92080e8b40d13ede76cc
4
+ data.tar.gz: 812136e28efdbcd73e32c2c39448603e44e586db
5
+ SHA512:
6
+ metadata.gz: 89a183a6bd4c783022fd3c73e30c892d450f08ee329b9bc58f8a79dd1ade8e30d95ec18e8e003293c7b13f79c07c1857cd0d0382190a8f1af7aa237b5546def6
7
+ data.tar.gz: 0f3cf9a5e798ec18391284ceba91e1dfbdd6cd2abf0fa92c73d30180bb94e4c5ce86be26300b08d1f96955b9b832fad16938378dd3730517f1ce4887f7f4c50d
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  begin
3
- require 'bundler/setup'
3
+ require 'bundler'
4
+ Bundler.require :default, :development
4
5
  rescue LoadError
5
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
7
  end
@@ -0,0 +1,33 @@
1
+ module ApiCanon
2
+ class SwaggerController < ActionController::Base
3
+
4
+ # TODO: Not sure about this
5
+ def set_headers
6
+ if request.headers["HTTP_ORIGIN"]
7
+ headers['Access-Control-Allow-Origin'] = request.headers["HTTP_ORIGIN"]
8
+ headers['Access-Control-Expose-Headers'] = 'ETag'
9
+ headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'
10
+ headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'
11
+ headers['Access-Control-Max-Age'] = '86400'
12
+ headers['Access-Control-Allow-Credentials'] = 'true'
13
+ end
14
+ end
15
+
16
+ def index
17
+ set_headers
18
+ api_docs = ::ApiCanon::DocumentationStore.docos
19
+ render :json => api_docs, :serializer => ApiCanon::Swagger::ResourceListing
20
+ end
21
+
22
+ def show
23
+ set_headers
24
+ api_doc = ::ApiCanon::DocumentationStore.fetch params[:id]
25
+ if api_doc
26
+ render :json => api_doc, :serializer => ApiCanon::Swagger::ApiDeclaration
27
+ else
28
+ head :not_found
29
+ end
30
+ end
31
+
32
+ end
33
+ end
@@ -1,6 +1,6 @@
1
1
  module ApiCanon
2
2
  module ApiCanonViewHelper
3
- if ::Rails.version.starts_with?('2')
3
+ if Rails.version.starts_with?('2')
4
4
  def content_for?(content_partial_name)
5
5
  instance_variable_get("@content_for_#{content_partial_name}")
6
6
  end
@@ -65,10 +65,7 @@
65
65
  <% content_for :sidebar do %>
66
66
  <ul class='nav nav-list'>
67
67
  <% ApiCanon::DocumentationStore.instance.docos.each do |key, doco| %>
68
- <li>
69
- <%- doco_link = doco.sidebar_link || url_for(:controller => doco.controller_path, :action => :index, :format => :html) -%>
70
- <%= link_to doco.display_name, doco_link %>
71
- </li>
68
+ <li><%= link_to doco.display_name, url_for(:controller => doco.controller_path, :action => :index, :format => :html) %></li>
72
69
  <% end %>
73
70
  </ul>
74
71
  <% end %>
@@ -1,10 +1,12 @@
1
1
  module ApiCanon
2
2
  class Document
3
- attr_reader :description, :controller_path, :controller_name, :sidebar_link
3
+ include ActiveModel::Serialization
4
+ attr_reader :description, :controller_path, :controller_name, :version
4
5
  attr_accessor :documented_actions
5
6
  def initialize(controller_path, controller_name, opts={})
6
7
  @controller_path = controller_path
7
8
  @controller_name = controller_name
9
+ @version = opts[:version]
8
10
  self.display_name = opts[:as]
9
11
  @documented_actions = []
10
12
  end
@@ -15,9 +17,6 @@ module ApiCanon
15
17
  def describe(desc)
16
18
  @description = desc
17
19
  end
18
- def link_path(link)
19
- @sidebar_link = link
20
- end
21
20
  def display_name
22
21
  @display_name || @controller_name.titleize
23
22
  end
@@ -4,11 +4,13 @@ module ApiCanon
4
4
  # with something that stores stuff in Redis or something
5
5
  class DocumentationStore
6
6
  include Singleton
7
+
7
8
  def store cont_doco
8
- @docos ||= {}
9
+ @docos ||= Docos.new
9
10
  @docos[cont_doco.controller_path] = cont_doco
10
11
  end
11
12
  def docos
13
+ Dir.glob("#{Rails.root}/app/controllers/*.rb").each { |f| require_dependency f}
12
14
  @docos ||= {}
13
15
  end
14
16
  def self.docos
@@ -20,5 +22,10 @@ module ApiCanon
20
22
  def self.fetch controller_path
21
23
  self.instance.docos[controller_path]
22
24
  end
25
+
26
+ class Docos < Hash
27
+ include ActiveModel::Serialization
28
+ end
29
+
23
30
  end
24
31
  end
@@ -1,13 +1,25 @@
1
1
  module ApiCanon
2
2
  class DocumentedAction
3
- attr_reader :params, :response_codes, :description, :action_name
4
- def initialize(action_name)
3
+ include ActiveModel::Serialization
4
+ attr_reader :params, :response_codes, :description, :action_name,
5
+ :controller_name, :http_method
6
+ def initialize(action_name, controller_name)
5
7
  @action_name = action_name
8
+ @controller_name = controller_name
6
9
  @params={}
7
10
  # TODO: This should check routes to see if params[:format] is expected
8
- @params[:format] = DocumentedParam.new :format,
11
+ @params[:format] = DocumentedParam.new :format, self,
9
12
  :default => :json, :example_values => [:json, :xml], :type => :string,
10
13
  :description => "The requested format of the response."
14
+
15
+ # This is based of the rails defaults.
16
+ @http_method = case action_name
17
+ when "create" then "POST"
18
+ when "update" then "PUT"
19
+ when "destory" then "DELETE"
20
+ else "GET"
21
+ end
22
+
11
23
  @response_codes={}
12
24
  end
13
25
  # The param method describes and gives examples for the parameters your
@@ -36,7 +48,7 @@ module ApiCanon
36
48
  # ```
37
49
  #
38
50
  def param(param_name, options={})
39
- @params[param_name] = DocumentedParam.new param_name, options
51
+ @params[param_name] = DocumentedParam.new param_name, self, options
40
52
  end
41
53
  # The response_code method will be used as a DSL method in the
42
54
  # document_method block to describe what you mean when your action returns
@@ -1,6 +1,7 @@
1
1
  module ApiCanon
2
2
  class DocumentedParam
3
- attr_accessor :name, :values, :type, :default, :description, :example_values
3
+ include ActiveModel::Serialization
4
+ attr_accessor :name, :values, :type, :default, :description, :example_values, :required, :description, :documented_action
4
5
  attr_writer :multiple
5
6
  include ActionView::Helpers
6
7
  def values_for_example
@@ -9,8 +10,9 @@ module ApiCanon
9
10
  def multiple?
10
11
  !!@multiple
11
12
  end
12
- def initialize(name, opts={})
13
+ def initialize(name, documented_action, opts={})
13
14
  @name = name
15
+ @documented_action = documented_action
14
16
  opts.each {|k,v| self.send("#{k}=", v) }
15
17
  end
16
18
  def form_values
@@ -9,6 +9,9 @@ module ApiCanon
9
9
  else
10
10
  map.match 'api_canon/test', route_opts
11
11
  end
12
+
13
+ # TODO: make :path => 'swagger-doc' customisable
14
+ map.resources :path => 'swagger-doc', :controller => 'api_canon/swagger', :only => [:index, :show], :as => :api_canon_swagger_doc
12
15
  end
13
16
  end
14
- end
17
+ end
@@ -0,0 +1,133 @@
1
+ module ApiCanon
2
+ module Swagger
3
+ class ApiDeclaration < ApiCanon::Swagger::Base
4
+
5
+ def apis
6
+ object.documented_actions.collect { |action| Api.new(action) }
7
+ end
8
+
9
+ class Api < ActiveModel::Serializer
10
+ self.root = false
11
+ attributes :path
12
+ attributes :description
13
+ attributes :operations
14
+
15
+ def path
16
+ url_params = {
17
+ :controller => object.controller_name,
18
+ :action => object.action_name,
19
+ :only_path => true
20
+ }
21
+
22
+ object.params.keys.each do |name|
23
+ url_params[name] = '{name}' unless name == :format
24
+ end
25
+
26
+ url = URI.unescape url_for(url_params)
27
+
28
+ # This is required because we dont know if the params are
29
+ # path params or query params, this way we dont care.
30
+ url = url.split('?').first
31
+
32
+ "#{url}.{format}"
33
+ end
34
+
35
+ def operations
36
+ [ Operation.new(object) ]
37
+ end
38
+
39
+
40
+ class Operation < ActiveModel::Serializer
41
+ self.root = false
42
+
43
+ attributes :http_method => :httpMethod,
44
+ :error_responses => :errorResponses
45
+ #:response_class => :responseClass
46
+ attributes :nickname, :parameters, :summary
47
+
48
+ def nickname
49
+ [
50
+ Rails.application.class.parent_name,
51
+ object.controller_name,
52
+ object.action_name,
53
+ http_method
54
+ ].join('-').downcase
55
+ end
56
+
57
+ def summary
58
+ object.description
59
+ end
60
+
61
+ def error_responses
62
+ object.response_codes.collect do |code, reason|
63
+ { :code => code, :reason => reason }
64
+ end
65
+ end
66
+
67
+ # def response_class
68
+ # object.controller_name.singularize.titlecase
69
+ # end
70
+
71
+ def parameters
72
+ object.params.collect do |name, param|
73
+ # Reject format because its not a real param :)
74
+ Parameter.new param unless name == :format
75
+ end.compact
76
+ end
77
+
78
+
79
+ class Parameter < ActiveModel::Serializer
80
+ self.root = false
81
+ attributes :param_type => :paramType,
82
+ :data_type => :dataType,
83
+ :allowable_values => :allowableValues,
84
+ :allow_multiple => :allowMultiple
85
+
86
+ attributes :name, :description, :required
87
+
88
+ def param_type
89
+ # TODO: Tighten this up.
90
+ if object.name == 'id'
91
+ "path"
92
+ elsif %(POST PUT).include?(object.documented_action.http_method)
93
+ "form"
94
+ else
95
+ "query"
96
+ end
97
+ end
98
+
99
+ def required
100
+ !!object.required
101
+ end
102
+
103
+ def allowable_values
104
+ if object.values.class == Range
105
+ {
106
+ :max => object.values.max,
107
+ :min => object.values.min,
108
+ :valueType => "RANGE"
109
+ }
110
+ elsif object.values.class == Array
111
+ {
112
+ :values => object.values,
113
+ :valueType => "LIST"
114
+ }
115
+ end
116
+ end
117
+
118
+ def allow_multiple
119
+ object.multiple?
120
+ end
121
+
122
+ def data_type
123
+ object.type
124
+ end
125
+
126
+ end
127
+
128
+ end
129
+ end
130
+
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,25 @@
1
+ module ApiCanon
2
+ module Swagger
3
+ class Base < ActiveModel::Serializer
4
+
5
+ self.root = false
6
+ attributes :api_version => :apiVersion
7
+ attributes :swagger_version => :swaggerVersion
8
+ attributes :base_path => :basePath
9
+ attributes :apis
10
+
11
+ def api_version
12
+ object.respond_to?(:version) ? object.version : object.collect { |key, val| val.version }.uniq.to_sentence
13
+ end
14
+
15
+ def swagger_version
16
+ 1.1
17
+ end
18
+
19
+ def base_path
20
+ defined?(api_canon_base_url) ? api_canon_base_url : api_canon_test_url.sub(api_canon_test_path,'/')
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ module ApiCanon
2
+ module Swagger
3
+ class ResourceListing < ApiCanon::Swagger::Base
4
+
5
+ def apis
6
+ object.collect do |endpoint, data|
7
+ {
8
+ :path => api_canon_swagger_doc_path(endpoint),
9
+ :description => data.description
10
+ }
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module ApiCanon
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/api_canon.rb CHANGED
@@ -1,13 +1,27 @@
1
- require 'api_canon/routes'
2
- require 'api_canon/version'
3
- require 'api_canon/app'
4
- require 'api_canon/document'
5
- require 'api_canon/documented_action'
6
- require 'api_canon/documented_param'
7
- require 'api_canon/documentation_store'
1
+ require 'rails'
2
+ require 'active_model'
3
+ require 'active_model/serializer'
8
4
 
9
5
  module ApiCanon
10
6
 
7
+ class Engine < ::Rails::Engine
8
+ # isolate_namespace ApiCanon
9
+
10
+ initializer "api_canon.initialization" do
11
+ require 'api_canon/routes'
12
+ require 'api_canon/version'
13
+ require 'api_canon/app'
14
+ require 'api_canon/document'
15
+ require 'api_canon/documented_action'
16
+ require 'api_canon/documented_param'
17
+ require 'api_canon/documentation_store'
18
+ require 'api_canon/swagger/base'
19
+ require 'api_canon/swagger/api_declaration'
20
+ require 'api_canon/swagger/resource_listing'
21
+ require 'controllers/swagger_controller'
22
+ end
23
+ end
24
+
11
25
  def self.included(base)
12
26
  base.extend(ClassMethods)
13
27
  base.class_eval do
@@ -28,7 +42,7 @@ module ApiCanon
28
42
  # which renders the ApiCanon documentation if params[:format] is html, and defaults
29
43
  # to the existing method otherwise.
30
44
  def index
31
- if request.format.html?
45
+ if params[:format].blank? || params[:format] == 'html'
32
46
  api_canon_docs
33
47
  else
34
48
  super
@@ -71,7 +85,7 @@ module ApiCanon
71
85
  def document_method(method_name,&block)
72
86
  document = DocumentationStore.fetch controller_path
73
87
  document ||= Document.new controller_path, controller_name
74
- documented_action = ApiCanon::DocumentedAction.new method_name
88
+ documented_action = ApiCanon::DocumentedAction.new method_name, controller_name
75
89
  documented_action.instance_eval &block if block_given?
76
90
  document.add_action documented_action
77
91
  DocumentationStore.store document
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/combustion_test.sqlite
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ ApiCanon::Routes.draw(self)
3
+ end
@@ -0,0 +1,3 @@
1
+ ActiveRecord::Schema.define do
2
+ #
3
+ end
File without changes
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  describe ApiCanon::DocumentedAction do
3
3
 
4
- let(:document) {ApiCanon::DocumentedAction.new :index}
4
+ let(:document) {ApiCanon::DocumentedAction.new :index, 'controller_name'}
5
5
  let(:description) {'ID is the unique identifier of the object'}
6
6
  subject { document }
7
7
  its(:action_name) { should == :index }
@@ -6,7 +6,7 @@ describe ApiCanon::DocumentedParam do
6
6
  end
7
7
  let(:fake_form) { mock :form }
8
8
  let(:doco_prefix) { 'foo' }
9
- let(:documented_param) {ApiCanon::DocumentedParam.new :format, doc_opts}
9
+ let(:documented_param) {ApiCanon::DocumentedParam.new :format, self, doc_opts}
10
10
  subject { documented_param }
11
11
  its(:name) { should eq :format }
12
12
  its(:type) { should eq 'string' }
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+ describe ApiCanon::Swagger::ApiDeclaration do
3
+
4
+ let(:data) {
5
+ documented_actions = ApiCanon::DocumentedAction.new('action_name', 'controller_name')
6
+ documented_actions.describe 'description'
7
+ documented_actions.response_code '404', 'reason'
8
+ documented_actions.param 'name', :description => 'description', :type => 'string', :values => (1..10)
9
+ mock :documented_actions => [ documented_actions ], :version => 'master'
10
+ }
11
+ subject { ApiCanon::Swagger::ApiDeclaration }
12
+
13
+
14
+ it 'should render the swagger api declaration' do
15
+ subject.any_instance.stub :api_canon_test_url => 'http://example.com/api_canon/test'
16
+ subject.any_instance.stub :api_canon_test_path => '/api_canon/test'
17
+ subject.any_instance.stub :swagger_path => 'swagger_path'
18
+ ApiCanon::Swagger::ApiDeclaration::Api.any_instance.stub :url_for => 'url_for'
19
+
20
+ JSON.parse(subject.new(data).to_json).should eql({
21
+ "apiVersion" => "master",
22
+ "basePath" => 'http://example.com/',
23
+ "swaggerVersion" => 1.1,
24
+ "apis" => [
25
+ {
26
+ "path" => "url_for.{format}",
27
+ "description" => 'description',
28
+ "operations" => [
29
+ {
30
+ "httpMethod" => "GET",
31
+ "errorResponses" => [{"code" => "404", "reason" => "reason"}],
32
+ "nickname" => "combustion-controller_name-action_name-get",
33
+ "parameters" => [
34
+ {
35
+ "paramType" => "query",
36
+ "dataType" => "string",
37
+ "allowableValues"=>{"max"=>10, "min"=>1, "valueType"=>"RANGE"},
38
+ "allowMultiple" => false,
39
+ "name" => "name",
40
+ "description" => 'description',
41
+ "required" => false
42
+ }
43
+ ],
44
+ "summary" => 'description'
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ })
50
+ end
51
+
52
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ describe ApiCanon::Swagger::ResourceListing do
3
+
4
+ let(:data) {
5
+ {
6
+ :controller => mock(
7
+ :version => 'master',
8
+ :description => 'description'
9
+ )
10
+ }
11
+ }
12
+ subject { ApiCanon::Swagger::ResourceListing }
13
+
14
+
15
+ it 'should render the swagger resource listing' do
16
+ subject.any_instance.stub :api_canon_base_url => 'root_url'
17
+ subject.any_instance.stub :api_canon_swagger_doc_path => '/swagger-doc'
18
+
19
+ JSON.parse(subject.new(data).to_json).should eql({
20
+ "apiVersion" => "master",
21
+ "basePath" => 'root_url',
22
+ "swaggerVersion" => 1.1,
23
+ "apis" => [{"path"=>"/swagger-doc", "description"=>"description"}]
24
+ })
25
+ end
26
+
27
+ end
28
+
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,11 @@
1
1
  # Configure Rails Environment
2
2
  ENV["RAILS_ENV"] = "test"
3
- require 'bundler'
4
- Bundler.setup
5
- class Rails
6
- def self.version
7
- '2.3.17'
8
- end
9
- end
3
+ require 'rails'
10
4
  require 'singleton'
11
5
  require 'action_controller'
6
+ require 'pry'
7
+ require 'combustion'
8
+ require 'rspec'
9
+ require 'rspec/rails'
12
10
  require 'api_canon'
13
- # Load support files
14
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
-
11
+ Combustion.initialize!
metadata CHANGED
@@ -1,101 +1,145 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: api_canon
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Cameron Walsh
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-08-12 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.17
20
+ type: :runtime
22
21
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 2
31
- - 3
32
- version: "2.3"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.17
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_model_serializers
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
33
34
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
36
42
  name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.13.0
48
+ type: :development
37
49
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
41
52
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 59
44
- segments:
45
- - 2
46
- - 13
47
- - 0
53
+ - !ruby/object:Gem::Version
48
54
  version: 2.13.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
49
62
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rake
53
63
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
63
76
  type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
66
84
  name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
67
91
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
77
104
  type: :development
78
- version_requirements: *id004
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: combustion
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
79
125
  description: |-
80
126
  api_canon is a declarative documentation generator
81
127
  for APIs. Declare the parameters and response codes,
82
128
  describe them, and give some example values. api_canon
83
129
  handles the rest for you.
84
- email:
130
+ email:
85
131
  - cameron.walsh@gmail.com
86
132
  executables: []
87
-
88
133
  extensions: []
89
-
90
134
  extra_rdoc_files: []
91
-
92
- files:
135
+ files:
93
136
  - app/views/api_canon/api_canon.html.erb
94
137
  - app/views/api_canon/_form.html.erb
95
138
  - app/views/api_canon/_api_canon.html.erb
96
139
  - app/views/api_canon/_rails_2_form.html.erb
97
140
  - app/views/application/index.html.erb
98
141
  - app/views/layouts/api_canon.html.erb
142
+ - app/controllers/swagger_controller.rb
99
143
  - app/controllers/api_canon_controller.rb
100
144
  - app/helpers/api_canon/api_canon_view_helper.rb
101
145
  - lib/api_canon/documented_param.rb
@@ -103,6 +147,9 @@ files:
103
147
  - lib/api_canon/documented_action.rb
104
148
  - lib/api_canon/documentation_store.rb
105
149
  - lib/api_canon/app.rb
150
+ - lib/api_canon/swagger/base.rb
151
+ - lib/api_canon/swagger/api_declaration.rb
152
+ - lib/api_canon/swagger/resource_listing.rb
106
153
  - lib/api_canon/document.rb
107
154
  - lib/api_canon/routes.rb
108
155
  - lib/tasks/api_canon_tasks.rake
@@ -112,47 +159,50 @@ files:
112
159
  - README.md
113
160
  - spec/spec_helper.rb
114
161
  - spec/lib/api_canon/documented_param_spec.rb
162
+ - spec/lib/api_canon/swagger_spec/api_declaration_spec.rb
163
+ - spec/lib/api_canon/swagger_spec/resource_listing_spec.rb
115
164
  - spec/lib/api_canon/documented_action_spec.rb
116
165
  - spec/lib/api_canon_spec.rb
166
+ - spec/internal/public/favicon.ico
167
+ - spec/internal/db/schema.rb
168
+ - spec/internal/config/database.yml
169
+ - spec/internal/config/routes.rb
117
170
  - spec/internal/log/test.log
118
171
  homepage: http://github.com/cwalsh/api_canon
119
- licenses:
172
+ licenses:
120
173
  - MIT
174
+ metadata: {}
121
175
  post_install_message:
122
176
  rdoc_options: []
123
-
124
- require_paths:
177
+ require_paths:
125
178
  - app
126
179
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
128
- none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
145
190
  requirements: []
146
-
147
191
  rubyforge_project:
148
- rubygems_version: 1.8.24
192
+ rubygems_version: 2.0.3
149
193
  signing_key:
150
- specification_version: 3
194
+ specification_version: 4
151
195
  summary: Declarative documentation generator for APIs.
152
- test_files:
196
+ test_files:
153
197
  - spec/spec_helper.rb
154
198
  - spec/lib/api_canon/documented_param_spec.rb
199
+ - spec/lib/api_canon/swagger_spec/api_declaration_spec.rb
200
+ - spec/lib/api_canon/swagger_spec/resource_listing_spec.rb
155
201
  - spec/lib/api_canon/documented_action_spec.rb
156
202
  - spec/lib/api_canon_spec.rb
203
+ - spec/internal/public/favicon.ico
204
+ - spec/internal/db/schema.rb
205
+ - spec/internal/config/database.yml
206
+ - spec/internal/config/routes.rb
157
207
  - spec/internal/log/test.log
158
208
  has_rdoc: