Class: Wiki
- Inherits:
-
Object
- Object
- Wiki
- Defined in:
- lib/wiki_fetch.rb
Instance Method Summary collapse
- #fetch_url(url) ⇒ Object
-
#initialize ⇒ Wiki
constructor
A new instance of Wiki.
- #search_suggestions(name, options = {}) ⇒ Object
- #search_title(name, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Wiki
Returns a new instance of Wiki.
6 7 8 |
# File 'lib/wiki_fetch.rb', line 6 def initialize() @@agent = Mechanize.new end |
Instance Method Details
#fetch_url(url) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/wiki_fetch.rb', line 22 def fetch_url(url) begin page_data = @@agent.get url return page_data.body rescue => e e. end end |
#search_suggestions(name, options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/wiki_fetch.rb', line 16 def search_suggestions(name, = {}) url = UrlFormatter.create_url({:name => name, :method => "search_suggestions", :options => }) puts url fetch_url(url) end |
#search_title(name, options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/wiki_fetch.rb', line 10 def search_title(name, = {}) url = UrlFormatter.create_url({:name => name, :method => "search_title", :options => }) puts url fetch_url(url) end |