class Avmtrf1::Tools::Runner::Esosti::Request

def json?

def json?
  parsed.json? || parsed.default?
end

def output_data

def output_data
  if yaml?
    out ::YAML.dump(response.body_data)
  else
    out response.body_str
  end
end

def request_headers

def request_headers
  r = {}
  %w[json xml].each do |format|
    r['Accept'] = "application/#{format}" if send("#{format}?")
  end
  r
end

def request_uncached

def request_uncached
  runner_context.call(:esosti_instance).request(url_suffix, request_headers)
end

def response_uncached

def response_uncached
  request.response
end

def run

def run
  start_banner
  output_data
end

def start_banner

def start_banner
  infov 'URL', request.url
  infom 'Recuperando informações...'
  infov 'Response status', response.status
end

def url_suffix

def url_suffix
  parsed.url_suffix
end

def xml?

def xml?
  parsed.xml?
end

def yaml?

def yaml?
  parsed.yaml? || parsed.default?
end