class Rambo::RamlModels::Body

Attributes

body[R]
type[R]

Public Class Methods

new(raml) click to toggle source
# File lib/rambo/raml_models/body.rb, line 9
def initialize(raml)
  @body = raml
end

Public Instance Methods

content_type() click to toggle source
# File lib/rambo/raml_models/body.rb, line 13
def content_type
  body.content_type
end
example() click to toggle source
# File lib/rambo/raml_models/body.rb, line 17
def example
  @example ||= body.example || generate_from_schema || {}.to_json
end
schema() click to toggle source
# File lib/rambo/raml_models/body.rb, line 21
def schema
  @schema ||= body.schema
end

Private Instance Methods

generate_from_schema() click to toggle source
# File lib/rambo/raml_models/body.rb, line 27
def generate_from_schema
  return nil unless body.schema
  JSON.pretty_generate(JsonTestData.generate!(body.schema, ruby: true))
end