class PostmanMarkdoc
Attributes
collections[R]
markdown[R]
Public Class Methods
files_to_markdown(*file_names)
click to toggle source
accepts filenames as arguments returns markdown string
# File lib/postman_markdoc.rb, line 7 def self.files_to_markdown(*file_names) raw_json = file_names.map{|f| IO.read(f)} collections = raw_json.map{|json| JSON.parse(json)} self.new(*collections).markdown end
new(*args)
click to toggle source
accepts hash representations of postman json collections
# File lib/postman_markdoc.rb, line 23 def initialize(*args) @collections = args generate_markdown end
raw_json_to_markdown(raw_json)
click to toggle source
accepts raw json collection string as argument returns markdown string
# File lib/postman_markdoc.rb, line 15 def self.raw_json_to_markdown(raw_json) collection = JSON.parse(raw_json) self.new(collection).markdown end
Public Instance Methods
generate_markdown()
click to toggle source
# File lib/postman_markdoc.rb, line 28 def generate_markdown @markdown = "" collections.each do |collection| @markdown << PostmanMarkdoc::MarkdownGenerator.generate( data: collection ).content end end