Class: WordPressImporter
Constant Summary
collapse
- RSD_SELECTOR =
'link[rel=EditURI]'
- METAWEB_SELECTOR =
'api[name=MetaWeblog]'
- MAX_POSTS_TO_REQUEST =
20
Instance Method Summary
collapse
#recent_posts, #rpc, #server
included
Instance Method Details
#api_url ⇒ Object
61
62
63
|
# File 'lib/server/importers/word_press_importer.rb', line 61
def api_url
@api_url ||= scan_for_url
end
|
#html ⇒ Object
33
34
35
|
# File 'lib/server/importers/word_press_importer.rb', line 33
def html
@html ||= open self.params['import_url']
end
|
#metaweblog_id ⇒ Object
57
58
59
|
# File 'lib/server/importers/word_press_importer.rb', line 57
def metaweblog_id
@metaweblog_id ||= scan_for_id
end
|
#rsd_doc ⇒ Object
49
50
51
|
# File 'lib/server/importers/word_press_importer.rb', line 49
def rsd_doc
@rsd_doc ||= Nokogiri::HTML(rsd_html)
end
|
#rsd_html ⇒ Object
53
54
55
|
# File 'lib/server/importers/word_press_importer.rb', line 53
def rsd_html
@rsd_html ||= open(rsd_url)
end
|
#rsd_url ⇒ Object
37
38
39
|
# File 'lib/server/importers/word_press_importer.rb', line 37
def rsd_url
@rsd_url ||= scan_for_rsd
end
|
#scan_for_id ⇒ Object
45
46
47
|
# File 'lib/server/importers/word_press_importer.rb', line 45
def scan_for_id
rsd_doc.css( METAWEB_SELECTOR ).first['blogid']
end
|
#scan_for_rsd ⇒ Object
41
42
43
|
# File 'lib/server/importers/word_press_importer.rb', line 41
def scan_for_rsd
site_doc.css( RSD_SELECTOR ).first['href']
end
|
#scan_for_url ⇒ Object
Methods below are helpers for detecting RSD for the XML-RPC protocol.
25
26
27
|
# File 'lib/server/importers/word_press_importer.rb', line 25
def scan_for_url
rsd_doc.css( METAWEB_SELECTOR ).first['apilink']
end
|
#site_doc ⇒ Object
29
30
31
|
# File 'lib/server/importers/word_press_importer.rb', line 29
def site_doc
@site_doc ||= Nokogiri::HTML(html)
end
|