Class: AbstractSyncer
- Inherits:
-
Object
- Object
- AbstractSyncer
- Defined in:
- lib/syncers/abstract_syncer.rb
Direct Known Subclasses
Instance Method Summary collapse
- #_fetch_html ⇒ Object
- #gen_html ⇒ Object
- #get_article_nodes ⇒ Object
- #get_article_xpath ⇒ Object
-
#initialize(uri) ⇒ AbstractSyncer
constructor
A new instance of AbstractSyncer.
Constructor Details
#initialize(uri) ⇒ AbstractSyncer
Returns a new instance of AbstractSyncer.
10 11 12 |
# File 'lib/syncers/abstract_syncer.rb', line 10 def initialize(uri) @uri = uri end |
Instance Method Details
#_fetch_html ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/syncers/abstract_syncer.rb', line 14 def _fetch_html uri = @uri res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http| # :use_ssl => true for the uri is https http.request(Net::HTTP::Get.new(uri, {'User-Agent' => USER_AGENT})) end res.body end |
#gen_html ⇒ Object
32 33 34 |
# File 'lib/syncers/abstract_syncer.rb', line 32 def gen_html raise MESSAGE % [__method__] end |
#get_article_nodes ⇒ Object
28 29 30 |
# File 'lib/syncers/abstract_syncer.rb', line 28 def get_article_nodes raise MESSAGE % [__method__] end |
#get_article_xpath ⇒ Object
24 25 26 |
# File 'lib/syncers/abstract_syncer.rb', line 24 def get_article_xpath raise MESSAGE % [__method__] end |