class Scrapula::Request

Attributes

agent[R]
method[R]
params[R]
url[R]

Public Class Methods

new(url:, method:, params: [], &block) click to toggle source
# File lib/scrapula/request.rb, line 6
          def initialize(url:, method:, params: [], &block)

          #     raise "Invalid http method: #{method}" unless Scrapula.http_methods.include? method

                  # Prepend the protocol if necessary
                  @url = url.sub /\A(?!(?:https?:\/\/))/, 'http://'

# TODO
agent = Agent.new

@agent, @method, @params = agent, method, params

# TODO
@headers = {}
@options = {
  redirects: 0
}
          end

Public Instance Methods

execute() click to toggle source
# File lib/scrapula/request.rb, line 25
def execute
  # TODO other methods
  # TODO other parameters
  Scrapula::Page.new agent.get @url, @params
end