Sha256: 496bbd16cbdc1167a701ab9e89ddc4dc8e83cb17dd82e38df4ace9a4b1b40118

Contents?: true

Size: 758 Bytes

Versions: 5

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

module Ryo
  module Plugin
    module Subdomain
      class Base
        attr_reader :fld
        def initialize(fld)
          @fld = fld
        end

        def endpoint
          raise NotImplementedError, "You must implement #{self.class}##{__method__}"
        end

        def fetch_body
          res = Client.http.get("#{endpoint}/#{fld}")
          res.body.to_s
        end

        def doc
          @doc ||= Oga.parse_html(fetch_body)
        end

        def parse
          raise NotImplementedError, "You must implement #{self.class}##{__method__}"
        end

        def discover
          parse
        end

        def self.discover(fld)
          new(fld).discover
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ryo-0.3.2 lib/ryo/plugin/subdomain/base.rb
ryo-0.3.1 lib/ryo/plugin/subdomain/base.rb
ryo-0.3.0 lib/ryo/plugin/subdomain/base.rb
ryo-0.2.0 lib/ryo/plugin/subdomain/base.rb
ryo-0.1.0 lib/ryo/plugin/subdomain/base.rb