mediawiki_api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mediawiki_api/client.rb +6 -0
- data/lib/mediawiki_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8395abe251559d9bdf235ea57ac6f03e53bc6f0
|
4
|
+
data.tar.gz: ad8ff2632ce626ee44fbaee68e0188ed2a7da3b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c93261cc228782ebac21aa2193824dcc65aa739eb254ec55ba0e7a217ee6f754e964f47f6faf543ccc36d7805dc67b084c9f28a3a16441c017532ca4998ab1cb
|
7
|
+
data.tar.gz: 724a2f1c2d41578427ed0bae7ed3bef54541d406f014bf274e45eccc9a8a6267bee9ca48538e740a4a8b2c4a51389b73dc3cd0bf08b78a7d3df1094b6a78e33f
|
data/Gemfile.lock
CHANGED
data/lib/mediawiki_api/client.rb
CHANGED
@@ -17,6 +17,7 @@ module MediawikiApi
|
|
17
17
|
|
18
18
|
def initialize(url, log=false)
|
19
19
|
@conn = Faraday.new(url: url) do |faraday|
|
20
|
+
faraday.request :multipart
|
20
21
|
faraday.request :url_encoded
|
21
22
|
if log then
|
22
23
|
faraday.response :logger
|
@@ -71,6 +72,11 @@ module MediawikiApi
|
|
71
72
|
resp = @conn.post "", { action: "delete", title: title, reason: reason, token: token, format: "json" }
|
72
73
|
end
|
73
74
|
|
75
|
+
def upload_image(filename ,path , comment, ignorewarnings)
|
76
|
+
token = get_token "edit"
|
77
|
+
@conn.post "", { action: "upload", filename: filename, file: Faraday::UploadIO.new(path, 'image/png'), token: token, comment: comment, ignorewarnings: ignorewarnings, format: "json"}
|
78
|
+
end
|
79
|
+
|
74
80
|
def get_wikitext(title)
|
75
81
|
resp = @conn.get "/w/index.php", { action: "raw", title: title }
|
76
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amir Aharoni
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-06-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: faraday
|