class Cynic::Response

Attributes

body[R]
content_type[R]
headers[R]
status[R]

Public Class Methods

new(body, request) click to toggle source
# File lib/cynic/response.rb, line 5
def initialize(body, request)
  @body = body
  @content_type = set_content_type(request)
end

Public Instance Methods

each(&block) click to toggle source
# File lib/cynic/response.rb, line 10
def each(&block)
  block.call @body
end
send() click to toggle source
# File lib/cynic/response.rb, line 30
def send
  [status, headers, self]
end
set_content_type(request) click to toggle source
# File lib/cynic/response.rb, line 18
def set_content_type(request)
  if request.params.has_key? "format"
    "text/#{request.params['format']}"
  else
    request.content_type =~ /text/ ? request.content_type : "text/html"
  end
end