Class: Ryo::Plugin::Subdomain::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ryo/plugin/subdomain/base.rb

Direct Known Subclasses

DNSDumpster, FindSubDomains

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fld) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/ryo/plugin/subdomain/base.rb', line 8

def initialize(fld)
  @fld = fld
end

Instance Attribute Details

#fldObject (readonly)

Returns the value of attribute fld.



7
8
9
# File 'lib/ryo/plugin/subdomain/base.rb', line 7

def fld
  @fld
end

Class Method Details

.discover(fld) ⇒ Object



33
34
35
# File 'lib/ryo/plugin/subdomain/base.rb', line 33

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

Instance Method Details

#discoverObject



29
30
31
# File 'lib/ryo/plugin/subdomain/base.rb', line 29

def discover
  parse
end

#docObject



21
22
23
# File 'lib/ryo/plugin/subdomain/base.rb', line 21

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

#endpointObject

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/ryo/plugin/subdomain/base.rb', line 12

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

#fetch_bodyObject



16
17
18
19
# File 'lib/ryo/plugin/subdomain/base.rb', line 16

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

#parseObject

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/ryo/plugin/subdomain/base.rb', line 25

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