Sha256: 4a143cd03c5220f122b385db0ffd9821a3af2e8a1fc18f9080538568848ca608

Contents?: true

Size: 1.16 KB

Versions: 69

Compression:

Stored size: 1.16 KB

Contents

module CMSScanner
  class Browser
    # Browser Actions (get, post etc)
    module Actions
      # @param [ String ] url
      # @param [ Hash ] params
      #
      # @return [ Typhoeus::Response ]
      def get(url, params = {})
        process(url, params.merge(method: :get))
      end

      # @param [ String ] url
      # @param [ Hash ] params
      #
      # @return [ Typhoeus::Response ]
      def post(url, params = {})
        process(url, params.merge(method: :post))
      end

      # @param [ String ] url
      # @param [ Hash ] params
      #
      # @return [ Typhoeus::Response ]
      def head(url, params = {})
        process(url, params.merge(method: :head))
      end

      # @param [ String ] url
      # @param [ Hash ] params
      #
      # @return [ Typhoeus::Response ]
      def get_and_follow_location(url, params = {})
        get(url, params.merge(followlocation: true))
      end

      protected

      # @param [ String ] url
      # @param [ Hash ] params
      #
      # @return [ Typhoeus::Response ]
      def process(url, params)
        Typhoeus::Request.new(url, NS::Browser.instance.request_params(params)).run
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
cms_scanner-0.0.10 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.9 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.8 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.7 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.6 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.5 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.4 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.3 lib/cms_scanner/browser/actions.rb
cms_scanner-0.0.2 lib/cms_scanner/browser/actions.rb