Class: Ryo::Plugin::Subdomain::Base
- Inherits:
-
Object
- Object
- Ryo::Plugin::Subdomain::Base
show all
- Defined in:
- lib/ryo/plugin/subdomain/base.rb
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
#fld ⇒ Object
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
#discover ⇒ Object
29
30
31
|
# File 'lib/ryo/plugin/subdomain/base.rb', line 29
def discover
parse
end
|
#doc ⇒ Object
21
22
23
|
# File 'lib/ryo/plugin/subdomain/base.rb', line 21
def doc
@doc ||= Oga.parse_html(fetch_body)
end
|
#endpoint ⇒ Object
12
13
14
|
# File 'lib/ryo/plugin/subdomain/base.rb', line 12
def endpoint
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|
#fetch_body ⇒ Object
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
|
#parse ⇒ Object
25
26
27
|
# File 'lib/ryo/plugin/subdomain/base.rb', line 25
def parse
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
|