From 50ce99639dced23d77026a2383c9c0d368c4387b Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Wed, 5 Nov 2014 10:07:19 +0000 Subject: [PATCH 1/3] remove references to unused @last_description variable --- lib/grape-swagger.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/grape-swagger.rb b/lib/grape-swagger.rb index 6a009d2a..4f325437 100644 --- a/lib/grape-swagger.rb +++ b/lib/grape-swagger.rb @@ -93,7 +93,6 @@ def self.setup(options) end desc api_doc.delete(:desc), params: api_doc.delete(:params) - @last_description.merge!(api_doc) get @@mount_path do header['Access-Control-Allow-Origin'] = '*' header['Access-Control-Request-Method'] = '*' @@ -139,7 +138,7 @@ def self.setup(options) required: true } }.merge(specific_api_doc.delete(:params) || {}) - @last_description.merge!(specific_api_doc) + get "#{@@mount_path}/:name" do header['Access-Control-Allow-Origin'] = '*' header['Access-Control-Request-Method'] = '*' From 1ab9d42a46df3467a69cd52f13671984711cc70e Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Wed, 5 Nov 2014 10:07:50 +0000 Subject: [PATCH 2/3] use new grape settings api --- lib/grape-swagger.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/grape-swagger.rb b/lib/grape-swagger.rb index 4f325437..6c084ac5 100644 --- a/lib/grape-swagger.rb +++ b/lib/grape-swagger.rb @@ -35,7 +35,7 @@ def add_swagger_documentation(options = {}) def combine_namespaces(app) app.endpoints.each do |endpoint| - ns = endpoint.settings.stack.last[:namespace] + ns = endpoint.namespace_stackable(:namespace).last @combined_namespaces[ns.space] = ns if ns combine_namespaces(endpoint.options[:app]) if endpoint.options[:app] @@ -297,10 +297,10 @@ def parse_params(params, path, method) end def content_types_for(target_class) - content_types = (target_class.settings[:content_types] || {}).values + content_types = (target_class.content_types || {}).values if content_types.empty? - formats = [target_class.settings[:format], target_class.settings[:default_format]].compact.uniq + formats = [target_class.format, target_class.default_format].compact.uniq formats = Grape::Formatter::Base.formatters({}).keys if formats.empty? content_types = Grape::ContentTypes::CONTENT_TYPES.select { |content_type, _mime_type| formats.include? content_type }.values end From 15c9579869dc1fddb253d125821595e7402f629f Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Wed, 5 Nov 2014 10:08:42 +0000 Subject: [PATCH 3/3] bump grape dependency --- grape-swagger.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grape-swagger.gemspec b/grape-swagger.gemspec index 73f771e4..7fae7c46 100644 --- a/grape-swagger.gemspec +++ b/grape-swagger.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.summary = 'A simple way to add auto generated documentation to your Grape API that can be displayed with Swagger.' s.license = 'MIT' - s.add_runtime_dependency 'grape' + s.add_runtime_dependency 'grape', '0.9.1' s.add_runtime_dependency 'grape-entity' s.add_development_dependency 'rake'