NAME

Facebook::OpenGraph::Response - Response object for Facebook::OpenGraph.

SYNOPSIS

my $res = Facebook::OpenGraph::Response->new($http_status_code, $http_status_message, $response_headers, $response_content);

DESCRIPTION

This handles response object for Facebook::OpenGraph.

METHODS

Class Methods

Facebook::OpenGraph::Response->new($status_code :Int, $status_mess :Str, $headers :ArrayRef, $content :Str) :Object

Creates and returns a new Facebook::OpenGraph::Response object.

Instance Methods

$res->code() :Int

Returns HTTP status code

$res->message() :Str

Returns HTTP status message

$res->content() :Str

Returns response body

$res->is_success() :Bool

Returns if status is 2XX or 304. 304 is added to handle $fb->fetch_with_etag();

$res->error_string() :Str

Returns error string.

$res->as_json() :Str

Returns response content as JSON string. Most of the time the response content itself is JSON formatted so it basically returns response content without doing anything. When Graph API returns plain text just saying 'true' or 'false,' it turns the content into JSON format like '{"success" : "(true|false)"}' so you can handle it in the same way as other case.

$res->as_hashref() :HashRef

Returns response content in hash reference.

$res->is_modified() :Bool

Returns if target object is modified. This method is called in $fb->fetch_with_etag().