class Apicraft::Openapi::Response

Represents an OpenAPI response.

def content

def content
  response.content
end

def content_for(content_type = nil)

def content_for(content_type = nil)
  return if content.blank?
  content[content_type || default_content_type]
end

def default_content_type

def default_content_type
  return if content.blank?
  content.keys[0]
end

def description

def description
  response.description
end

def initialize(response)

def initialize(response)
  @response = response
end

def mock(content_type = nil)

def mock(content_type = nil)
  [
    Mocker.mock(
      schema_for(content_type || default_content_type)
    ),
    content_type || default_content_type
  ]
end

def schema_for(content_type = nil)

def schema_for(content_type = nil)
  content_for(content_type || default_content_type)&.schema
end