mediawiki_api 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b82db68eb6a5a88ae5692c07b4f2383b038aee26
4
- data.tar.gz: 384cbe196904ac7cdc461025229b5c96181cc0a8
3
+ metadata.gz: 41c2dd44c6fc40c892dba0f16d889db55f0f3ae9
4
+ data.tar.gz: 2d5c82f2aae43baadb25ecc82be9555eeee75815
5
5
  SHA512:
6
- metadata.gz: c7ab7b8b7bd86e3aa2b0b9774fa94e7827a49041d79be80993a2e5bdc5e725926010aaf008a9fe3bf54df3e9c7dd3f72fba25814e7fd6fbd2225b79fe20e0894
7
- data.tar.gz: 64400b6f60afa1032bb0177d8e35882172a0d1872fa8769ad1503fa3a0e8d4ceea3fc2d29aa313ccf352b28c95fc51eb9c1f434b4f2033fcfc1d8d77037b4e12
6
+ metadata.gz: 5645e2743b93f1143741a47dc05e9b19ee2508c8aa916bff6302d6e87e9de045e4996f59f803d69847eb5d91e6511737a2ed973358864810eff6140f074d2a4a
7
+ data.tar.gz: c5a9ecafd25845f3849efec516e45edd26dfb52469dcc838eaf431db440d6709977d831487abc8afb1c1238ddf305c3cd150ba23368f417de5eb51676d5086ff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mediawiki_api (0.1.0)
4
+ mediawiki_api (0.1.1)
5
5
  faraday (~> 0.9, >= 0.9.0)
6
6
  faraday-cookie_jar (~> 0.0, >= 0.0.6)
7
7
 
@@ -12,7 +12,7 @@ GEM
12
12
  crack (0.4.2)
13
13
  safe_yaml (~> 1.0.0)
14
14
  diff-lcs (1.2.5)
15
- domain_name (0.5.16)
15
+ domain_name (0.5.18)
16
16
  unf (>= 0.0.5, < 1.0.0)
17
17
  faraday (0.9.0)
18
18
  multipart-post (>= 1.2, < 3)
@@ -32,7 +32,7 @@ GEM
32
32
  diff-lcs (>= 1.1.3, < 2.0)
33
33
  rspec-mocks (2.14.6)
34
34
  safe_yaml (1.0.1)
35
- unf (0.1.3)
35
+ unf (0.1.4)
36
36
  unf_ext
37
37
  unf_ext (0.0.6)
38
38
  webmock (1.17.4)
@@ -15,10 +15,12 @@ module MediawikiApi
15
15
  class Client
16
16
  attr_accessor :logged_in
17
17
 
18
- def initialize(url)
18
+ def initialize(url, log=false)
19
19
  @conn = Faraday.new(url: url) do |faraday|
20
20
  faraday.request :url_encoded
21
- faraday.response :logger
21
+ if log then
22
+ faraday.response :logger
23
+ end
22
24
  faraday.use :cookie_jar
23
25
  faraday.adapter Faraday.default_adapter
24
26
  end
@@ -69,6 +71,10 @@ module MediawikiApi
69
71
  resp = @conn.post "", { action: "delete", title: title, reason: reason, token: token, format: "json" }
70
72
  end
71
73
 
74
+ def get_wikitext(title)
75
+ resp = @conn.get "/w/index.php", { action: "raw", title: title }
76
+ end
77
+
72
78
  protected
73
79
 
74
80
  def get_token(type)
@@ -1,3 +1,3 @@
1
1
  module MediawikiApi
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -101,6 +101,17 @@ describe MediawikiApi::Client do
101
101
  # evaluate results
102
102
  end
103
103
 
104
+ describe "#get_wikitext" do
105
+ before do
106
+ @get_req = stub_request(:get, index_url).with(query: { action: "raw", title: "Test" })
107
+ end
108
+
109
+ it "fetches a page" do
110
+ subject.get_wikitext("Test")
111
+ @get_req.should have_been_requested
112
+ end
113
+ end
114
+
104
115
  describe "#create_account" do
105
116
  it "creates an account when API returns Success" do
106
117
  stub_request(:post, api_url).
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,9 @@ module TestHelpers
6
6
  def api_url
7
7
  "http://localhost/api.php"
8
8
  end
9
+ def index_url
10
+ "http://localhost/w/index.php"
11
+ end
9
12
  end
10
13
 
11
14
  RSpec.configure do |conf|
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.1
4
+ version: 0.1.2
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-04-01 00:00:00.000000000 Z
15
+ date: 2014-04-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: faraday