Class: PostmanDocGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/postman_doc_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_method, path, controller, response) ⇒ PostmanDocGenerator

Returns a new instance of PostmanDocGenerator.



18
19
20
21
22
23
24
# File 'lib/postman_doc_generator.rb', line 18

def initialize(http_method, path, controller, response)
  @sample_dir = "#{File.expand_path("#{File.dirname(__FILE__)}/..")}/sample"
  @http_method = http_method.upcase.to_s
  @path = path
  @controller = controller
  @response = response
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



5
6
7
# File 'lib/postman_doc_generator.rb', line 5

def error
  @error
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/postman_doc_generator.rb', line 5

def result
  @result
end

Class Method Details

.start(http_method, path, controller, response) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/postman_doc_generator.rb', line 8

def start(http_method, path, controller, response)
  generator = new(http_method, path, controller, response)
  generator.call
rescue => e
  generator.error = e
ensure
  generator
end

Instance Method Details

#callObject



26
27
28
29
30
31
# File 'lib/postman_doc_generator.rb', line 26

def call
  get_basic_setting
  setup_basic_info
  setup_postman_json
  save_to_file
end