wiki_fetch 0.0.1.alpha.3 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wiki_fetch/url_formatter.rb +5 -3
- data/lib/wiki_fetch/version.rb +1 -1
- data/lib/wiki_fetch.rb +5 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d92cbad1cb0199467a429b2787df48317d9d6da
|
4
|
+
data.tar.gz: c81e1f7a3f81ae1fad4b242fcf3f15e1ef8cb544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f55fc6768046ad8dc7dda7dde6e2fbcb83124f93a886d77f56b02a7fedba781e78cc03625b3ee5110e0534f99ff47ea7b46c7796d6a770ed01bf7b018e8d3f
|
7
|
+
data.tar.gz: d943ea44ce55df0d50ea8304f1fd94d8f8112f90178a0d714875bfb9f468a36af539acea754823db90650d9df42e21220db7d765808bfc0db1c6a5b1046726fc
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'wiki_fetch/global'
|
2
|
+
|
1
3
|
module UrlFormatter
|
2
4
|
def self.create_url(options)
|
3
5
|
format = options[:format] || "json"
|
@@ -6,14 +8,14 @@ module UrlFormatter
|
|
6
8
|
query = options[:options][:action] || "query"
|
7
9
|
extracts = options[:options][:prop] || "extracts"
|
8
10
|
exsentences = (options[:options][:exsentences] || 10).to_i
|
9
|
-
return "#{$wiki_base_url}?format=#{format}&action=#{query}&prop=#{extracts}&exsentences=#{exsentences}&titles=#{options[:
|
11
|
+
return "#{$wiki_base_url}?format=#{format}&action=#{query}&prop=#{extracts}&exsentences=#{exsentences}&titles=#{options[:name]}"
|
10
12
|
when "search_suggestions"
|
11
13
|
query = options[:options][:action] || "opensearch"
|
12
14
|
limit = (options[:options][:limit] || 10).to_i
|
13
15
|
namespace = (options[:options][:namespace] || 0).to_i
|
14
|
-
return "#{$wiki_base_url}?action=#{query}&search=#{options[:
|
16
|
+
return "#{$wiki_base_url}?action=#{query}&search=#{options[:name]}&limit=#{limit}&namespace=#{namespace}&format=#{format}"
|
15
17
|
else
|
16
18
|
puts "You gave me -- I have no idea what to do with that."
|
17
19
|
end
|
18
20
|
end
|
19
|
-
|
21
|
+
end
|
data/lib/wiki_fetch/version.rb
CHANGED
data/lib/wiki_fetch.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require "wiki_fetch/version"
|
2
2
|
require 'mechanize'
|
3
|
+
require "wiki_fetch/url_formatter"
|
3
4
|
|
4
5
|
class Wiki
|
5
6
|
def initialize()
|
6
7
|
@@agent = Mechanize.new
|
7
8
|
end
|
8
9
|
|
9
|
-
def search_title(name, options)
|
10
|
+
def search_title(name, options = {})
|
10
11
|
url = UrlFormatter.create_url({:name => name, :method => "search_title", :options => options})
|
12
|
+
puts url
|
11
13
|
fetch_url(url)
|
12
14
|
end
|
13
15
|
|
14
|
-
def search_suggestions(name, options)
|
16
|
+
def search_suggestions(name, options = {})
|
15
17
|
url = UrlFormatter.create_url({:name => name, :method => "search_suggestions", :options => options})
|
18
|
+
puts url
|
16
19
|
fetch_url(url)
|
17
20
|
end
|
18
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiki_fetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nileshpatil47
|
@@ -84,9 +84,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
92
|
rubygems_version: 2.0.3
|