module GrapeDSL::Extend::APIMNT
Public Instance Methods
console_write_out_routes()
click to toggle source
write out to the console the class routes
# File lib/grape-dsl/dsl.rb, line 60 def console_write_out_routes $stdout.puts "\n\nREST::API ROUTES:" self.routes.each do |route| $stdout.puts "#{route.route_method}","\t#{route.route_path}\n---\n" end return nil end
Also aliased as: cw_routes, puts_routes
description(opts={})
click to toggle source
defaults desc -> description for path body -> return body from the call convent_type -> real content type
# File lib/grape-dsl/dsl.rb, line 11 def description(opts={}) @last_description ||= {} unless @last_description[:description].class == Hashie::Mash @last_description[:description]= Hashie::Mash.new( opts.merge( desc: @last_description[:desc], content_type: self.content_types ) ) end return @last_description[:description] end
description=(obj)
click to toggle source
# File lib/grape-dsl/dsl.rb, line 27 def description= obj self.description.desc= obj end
mount_by(opts= {})
click to toggle source
mount all the rest api classes that is subclass of the Grape::API make easy to manage
# File lib/grape-dsl/dsl.rb, line 34 def mount_by opts= {} raise unless opts.class <= ::Hash opts[:class] ||= opts[:klass] || opts[:k] || opts[:c] || Grape::API opts[:ex] ||= opts[:except] || opts[:exception] || opts[:e] || [] opts[:in] ||= opts[:include] || opts[:inclusion] || opts[:i] || [] [:ex,:in].each{|sym| (opts[sym]=[opts[sym]]) unless opts[sym].class <= Array } # mount components opts[:class].inherited_by.each do |component| mount(component) unless opts[:ex].include?(component) || self == component end opts[:in].each{ |klass| self.mount(klass) } return nil end
mount_subclasses(*exception)
click to toggle source
# File lib/grape-dsl/dsl.rb, line 55 def mount_subclasses(*exception) mount_by ex: exception end
Also aliased as: mount_classes