class Fictium::Postman::V2Exporter::ActionFormatter

Public Instance Methods

format(action) click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 5
def format(action)
  metadata_formatter.format(action, build_base(action))
end

Private Instance Methods

build_base(action) click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 11
def build_base(action)
  {
    id: "#{action.method} - #{action.full_path}",
    name: action.summary,
    description: action.description,
    request: request_formatter.format(action.default_example),
    response: format_responses(action)
  }
end
format_responses(action) click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 21
def format_responses(action)
  result = action.examples.map { |example| response_formatter.format(example) }
  result.reject(&:blank?)
end
metadata_formatter() click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 34
def metadata_formatter
  @metadata_formatter ||= MetadataFormatter.new
end
request_formatter() click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 26
def request_formatter
  @request_formatter ||= RequestFormatter.new
end
response_formatter() click to toggle source
# File lib/fictium/exporters/postman/v2_exporter/action_formatter.rb, line 30
def response_formatter
  @response_formatter ||= ResponseFormatter.new
end