class Swagger::Template::Tasks
Public Class Methods
new(options = {})
click to toggle source
# File lib/swagger/template/tasks.rb, line 9 def initialize(options = {}) @swagger_path = options[:swagger_path] @templates_path = options[:templates_path] @examples = JSON.parse(File.read(options[:examples])) @output_path = options[:output_path] @language = options[:language] @root_entity = options[:root_entity] end
Public Instance Methods
generate()
click to toggle source
# File lib/swagger/template/tasks.rb, line 25 def generate endpoints = Swagger::Template::Tasks::Reader.new(@swagger_path).read Swagger::Template::Tasks::Writer.new( endpoints: endpoints, templates_path: @templates_path, output_path: @output_path, root_entity: @root_entity, root_entity_class: @root_entity.split('_').map(&:capitalize).join, language: @language, examples: @examples ).write end
list()
click to toggle source
# File lib/swagger/template/tasks.rb, line 18 def list endpoints = Swagger::Template::Tasks::Reader.new(@swagger_path).read endpoints.each do |endpoint| ap endpoint.to_h end end