Method: OpenGraphReader::Fetcher#body

Defined in:
lib/open_graph_reader/fetcher.rb

#bodyString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

Custom error class

Retrieve the body

Returns:

  • (String)

Raises:

  • (ArgumentError)

    The received content does not seems to be HTML.



71
72
73
74
75
76
77
# File 'lib/open_graph_reader/fetcher.rb', line 71

def body
  fetch_body unless fetched?
  raise NoOpenGraphDataError, "No response body received for #{@uri}" if fetch_failed?
  raise NoOpenGraphDataError, "Did not receive a HTML site at #{@uri}" unless html?

  @get_response.body
end