class Arachnid::Resource

Overview

Represents a resource requested from a website

Included Modules

Defined in:

arachnid/resource/content_types.cr
arachnid/resource/cookies.cr
arachnid/resource/html.cr
arachnid/resource/status_codes.cr
arachnid/resource.cr

Constructors

Instance Method Summary

Instance methods inherited from module Arachnid::Resource::StatusCodes

bad_request? bad_request?, code code, forbidden? forbidden?, had_internal_server_error? had_internal_server_error?, missing? missing?, ok? ok?, redirect? redirect?, timedout? timedout?, unauthorized? unauthorized?

Instance methods inherited from module Arachnid::Resource::HTML

each(&block) each, each_image(&block : URI -> ) each_image, each_link(&block : URI -> ) each_link, each_mailto(&block) each_mailto, each_meta_redirect(&block : URI -> ) each_meta_redirect, each_redirect(&block : URI -> ) each_redirect, each_resource(&block : URI -> ) each_resource, each_script(&block : URI -> ) each_script, each_url(&block : URI -> ) each_url, each_video(&block : URI -> ) each_video, links links, mailtos mailtos, meta_redirect? meta_redirect?, meta_redirects meta_redirects, redirects_to redirects_to, title title, to_absolute(link) to_absolute, urls urls

Instance methods inherited from module Arachnid::Resource::Cookies

cookie cookie, cookies cookies

Instance methods inherited from module Arachnid::Resource::ContentTypes

atom? atom?, avi? avi?, content_charset content_charset, content_type content_type, content_types content_types, css? css?, directory? directory?, flash? flash?, gif? gif?, html? html?, image? image?, is_content_type?(type : String | Regex) is_content_type?, javascript? javascript?, jpg? jpg?, json? json?, mp4? mp4?, ms_word? ms_word?, pdf? pdf?, plain_text? plain_text?, png? png?, quicktime? quicktime?, rss? rss?, svg? svg?, text? text?, video? video?, wmv? wmv?, xml? xml?, xsl? xsl?, zip? zip?

Constructor Detail

def self.new(url : URI, response : Halite::Response) #

Creates a new Resource object.


[View source]

Instance Method Detail

def %(path) #

Alias for #at


[View source]
def /(path) #

Alias for #search


[View source]
def at(path) #

Searches for the first occurrence of an XPath or CSS path


[View source]
def at_css(*args, **options) #

[View source]
def at_css(*args, **options, &block) #

[View source]
def at_id(*args, **options) #

[View source]
def at_id(*args, **options, &block) #

[View source]
def at_tag(*args, **options) #

[View source]
def at_tag(*args, **options, &block) #

[View source]
def body #

The body of the response


[View source]
def css(*args, **options, &block) #

[View source]
def css(*args, **options) #

[View source]
def doc #

Returns a parsed document for HTML, XML, RSS, and Atom resources.


[View source]
def headers : HTTP::Headers #

Headers returned with the body


[View source]
def response : Halite::Response #

HTTP response


[View source]
def root(*args, **options) #

[View source]
def root(*args, **options, &block) #

[View source]
def search(path) #

Searches the document for XPath or CSS paths


[View source]
def size #

Get the size of the body in bytes (useful for binaries)


[View source]
def to_s #

[View source]
def url : URI #

URL of the resource


[View source]
def where_class(*args, **options) #

[View source]
def where_class(*args, **options, &block) #

[View source]
def where_tag(*args, **options) #

[View source]
def where_tag(*args, **options, &block) #

[View source]
def xpath(*args, **options, &block) #

[View source]
def xpath(*args, **options) #

[View source]
def xpath_bool(*args, **options) #

[View source]
def xpath_bool(*args, **options, &block) #

[View source]
def xpath_float(*args, **options, &block) #

[View source]
def xpath_float(*args, **options) #

[View source]
def xpath_node(*args, **options, &block) #

[View source]
def xpath_node(*args, **options) #

[View source]
def xpath_nodes(*args, **options, &block) #

[View source]
def xpath_nodes(*args, **options) #

[View source]
def xpath_string(*args, **options, &block) #

[View source]
def xpath_string(*args, **options) #

[View source]