Sha256: edb45958a24860070c7a920d5361067f74afa3ae89824e857ced5ff257db2ff6

Contents?: true

Size: 1.15 KB

Versions: 10

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Mihari
  module Analyzers
    #
    # Feed analyzer
    #
    class Feed < Base
      # @return [Hash, nil]
      attr_reader :form

      # @return [Hash, nil]
      attr_reader :json

      # @return [Hash, nil]
      attr_reader :params

      # @return [Hash]
      attr_reader :headers

      # @return [String]
      attr_reader :method

      # @return [String]
      attr_reader :selector

      # @return [String]
      attr_reader :query

      #
      # @param [String] url
      # @param [Hash, nil] options
      # @param [Hash] params
      #
      def initialize(url, options: nil, **params)
        super(url, options:)

        @method = params[:method] || "GET"
        @headers = params[:headers] || {}
        @params = params[:params]
        @json = params[:json]
        @form = params[:form]
        @selector = params[:selector] || ""
      end

      def artifacts
        data = Services::FeedReader.call(
          url, headers:, method:, params:, json:, form:, timeout:
        )
        Services::FeedParser.call(data, selector)
      end

      private

      def url
        query
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mihari-8.0.2 lib/mihari/analyzers/feed.rb
mihari-8.0.1 lib/mihari/analyzers/feed.rb
mihari-8.0.0 lib/mihari/analyzers/feed.rb
mihari-7.6.4 lib/mihari/analyzers/feed.rb
mihari-7.6.3 lib/mihari/analyzers/feed.rb
mihari-7.6.2 lib/mihari/analyzers/feed.rb
mihari-7.6.1 lib/mihari/analyzers/feed.rb
mihari-7.6.0 lib/mihari/analyzers/feed.rb
mihari-7.5.0 lib/mihari/analyzers/feed.rb
mihari-7.4.0 lib/mihari/analyzers/feed.rb