wikidot-api 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require "rubygems"
2
2
  require "xmlrpc/client"
3
+ require "cgi"
3
4
 
4
5
  # Enable NIL extension to handle <nil/> values
5
6
  XMLRPC::Config::ENABLE_NIL_CREATE = true
@@ -8,6 +8,7 @@ module WikidotAPI
8
8
  @host = opts[:host] || "www.wikidot.com"
9
9
  @proto = opts[:proto] || "https"
10
10
  @port = opts[:port] || false
11
+ @query_options = opts[:query_options] || false
11
12
  end
12
13
 
13
14
  def call method, *args
@@ -33,11 +34,15 @@ module WikidotAPI
33
34
  def server
34
35
  @server ||= XMLRPC::Client.new2 endpoint_uri
35
36
  end
37
+
38
+ def query_options_string
39
+ "?" + @query_options.map{|o| p "#{CGI.escape(o[0].to_s)}=#{CGI.escape(o[1].to_s)}"}.join("&") if @query_options
40
+ end
36
41
 
37
42
  def endpoint_uri
38
- "#{@proto}://#{@app}:#{@key}@#{@host}#{@port ? ':' + @port.to_s : ''}/xml-rpc-api.php"
43
+ "#{@proto}://#{@app}:#{@key}@#{@host}#{@port ? ':' + @port.to_s : ''}/xml-rpc-api.php#{query_options_string}"
39
44
  end
40
45
 
41
- private :server, :endpoint_uri
46
+ private :server, :endpoint_uri, :query_options_string
42
47
  end
43
48
  end
@@ -1,3 +1,3 @@
1
1
  module WikidotAPI
2
- Version = '0.0.2'
2
+ Version = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikidot-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
4
+ prerelease:
5
+ version: 0.0.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - "Micha\xC5\x82 Fr\xC4\x85ckowiak"
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-06-23 00:00:00 +02:00
19
- default_executable:
13
+ date: 2011-06-09 00:00:00 Z
20
14
  dependencies: []
21
15
 
22
16
  description: |
@@ -36,7 +30,6 @@ files:
36
30
  - lib/wikidot_api/client.rb
37
31
  - lib/wikidot_api/version.rb
38
32
  - lib/wikidot_api.rb
39
- has_rdoc: true
40
33
  homepage: http://github.com/michalf/wikidot-api
41
34
  licenses: []
42
35
 
@@ -50,23 +43,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
43
  requirements:
51
44
  - - ">="
52
45
  - !ruby/object:Gem::Version
53
- hash: 3
54
- segments:
55
- - 0
56
46
  version: "0"
57
47
  required_rubygems_version: !ruby/object:Gem::Requirement
58
48
  none: false
59
49
  requirements:
60
50
  - - ">="
61
51
  - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
52
  version: "0"
66
53
  requirements: []
67
54
 
68
55
  rubyforge_project:
69
- rubygems_version: 1.3.7
56
+ rubygems_version: 1.7.2
70
57
  signing_key:
71
58
  specification_version: 3
72
59
  summary: Simple Ruby client library for Wikidot RPC API