Class: AbstractSyncer

Inherits:
Object
  • Object
show all
Defined in:
lib/syncers/abstract_syncer.rb

Direct Known Subclasses

PerNodeSyncer

Instance Method Summary collapse

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_htmlObject



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_htmlObject



32
33
34
# File 'lib/syncers/abstract_syncer.rb', line 32

def gen_html
  raise MESSAGE % [__method__]
end

#get_article_nodesObject



28
29
30
# File 'lib/syncers/abstract_syncer.rb', line 28

def get_article_nodes
  raise MESSAGE % [__method__]
end

#get_article_xpathObject



24
25
26
# File 'lib/syncers/abstract_syncer.rb', line 24

def get_article_xpath
  raise MESSAGE % [__method__]
end