JuanitoFatas/comer_de_tapas

View on GitHub
lib/comer_de_tapas/fetcher.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "celluloid/io"

module ComerDeTapas
  class Fetcher
    include Celluloid::IO

    # Fetch url with given cookie, and query string (optional)
    # @param [String] url
    # @param cookie
    # @option query [Hash]
    def fetch url, cookie, query={}
      require "http"
      HTTP.with("Cookie" => cookie).get(url, ssl_socket_class: Celluloid::IO::SSLSocket, params: query)
    end
  end
end