localwiki_client 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -1
- data/History.txt +11 -0
- data/README.md +33 -0
- data/Rakefile +19 -2
- data/integration/helper.rb +9 -0
- data/{spec/integration → integration}/live_saltlake_wiki_spec.rb +2 -2
- data/integration/live_test_wiki_spec.rb +47 -0
- data/lib/localwiki/client.rb +131 -38
- data/lib/localwiki/version.rb +1 -1
- data/localwiki_client.gemspec +6 -2
- data/spec/basic_crud_spec.rb +67 -0
- data/spec/basic_spec.rb +34 -0
- data/spec/fetch_version_spec.rb +43 -0
- data/spec/fixtures/cassettes/basic.yml +91 -0
- data/spec/fixtures/cassettes/basic_crud.yml +90 -0
- data/spec/fixtures/cassettes/basic_crud_delete_fail.yml +42 -0
- data/spec/fixtures/cassettes/basic_crud_delete_success.yml +42 -0
- data/spec/fixtures/cassettes/basic_crud_read_fail.yml +52 -0
- data/spec/fixtures/cassettes/basic_crud_read_success.yml +40 -0
- data/spec/fixtures/cassettes/basic_crud_update_success.yml +42 -0
- data/spec/fixtures/cassettes/basic_fetch_version_success.yml +130 -0
- data/spec/fixtures/cassettes/basic_page_by_name_spaces.yml +41 -0
- data/spec/fixtures/cassettes/basic_unique_authors_success.yml +130 -0
- data/spec/fixtures/cassettes/fetch.yml +46 -0
- data/spec/fixtures/cassettes/localwiki_client.yml +366 -0
- data/spec/fixtures/cassettes/slug.yml +46 -0
- data/spec/helper.rb +15 -3
- data/spec/localwiki_client_spec.rb +31 -25
- data/spec/slug_spec.rb +26 -0
- metadata +100 -61
- data/localwiki_client-0.0.4.gem +0 -0
- data/spec/data/page_fetch.json +0 -9
- data/spec/data/site_fetch.json +0 -10
- data/spec/data/site_list.json +0 -18
- data/spec/data/user_list.json +0 -49
- data/spec/page_spec.rb +0 -41
- data/spec/site_spec.rb +0 -48
- data/spec/user_spec.rb +0 -41
@@ -0,0 +1,130 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"name":"TestPage72aa8993-bc09-4010-af55-e161b64929bb","content":"<p>Created!</p>"}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Authorization:
|
13
|
+
- ApiKey testuser:key
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 201
|
21
|
+
message: CREATED
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Sat, 16 Mar 2013 05:14:52 GMT
|
25
|
+
Server:
|
26
|
+
- Apache/2.2.22 (Ubuntu)
|
27
|
+
Vary:
|
28
|
+
- Cookie,Accept-Encoding
|
29
|
+
Access-Control-Allow-Origin:
|
30
|
+
- ! '*'
|
31
|
+
Access-Control-Allow-Methods:
|
32
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
33
|
+
Set-Cookie:
|
34
|
+
- sessionid=4718abd955b8a9a6ad1fe1508702c92b; expires=Sat, 30-Mar-2013 05:14:52
|
35
|
+
GMT; Max-Age=1209600; Path=/
|
36
|
+
Location:
|
37
|
+
- http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page/TestPage72aa8993-bc09-4010-af55-e161b64929bb
|
38
|
+
Content-Length:
|
39
|
+
- '0'
|
40
|
+
Content-Type:
|
41
|
+
- text/html; charset=utf-8
|
42
|
+
body:
|
43
|
+
encoding: US-ASCII
|
44
|
+
string: ''
|
45
|
+
http_version:
|
46
|
+
recorded_at: Sat, 16 Mar 2013 05:14:21 GMT
|
47
|
+
- request:
|
48
|
+
method: put
|
49
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page/TestPage72aa8993-bc09-4010-af55-e161b64929bb
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: ! '{"content":"<p>foo</p>"}'
|
53
|
+
headers:
|
54
|
+
Content-Type:
|
55
|
+
- application/json
|
56
|
+
Authorization:
|
57
|
+
- ApiKey testuser:key
|
58
|
+
Accept:
|
59
|
+
- ! '*/*'
|
60
|
+
User-Agent:
|
61
|
+
- Ruby
|
62
|
+
response:
|
63
|
+
status:
|
64
|
+
code: 204
|
65
|
+
message: NO CONTENT
|
66
|
+
headers:
|
67
|
+
Date:
|
68
|
+
- Sat, 16 Mar 2013 05:14:52 GMT
|
69
|
+
Server:
|
70
|
+
- Apache/2.2.22 (Ubuntu)
|
71
|
+
Access-Control-Allow-Origin:
|
72
|
+
- ! '*'
|
73
|
+
Access-Control-Allow-Methods:
|
74
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
75
|
+
Content-Length:
|
76
|
+
- '0'
|
77
|
+
Vary:
|
78
|
+
- Accept-Encoding
|
79
|
+
Content-Type:
|
80
|
+
- text/html; charset=utf-8
|
81
|
+
body:
|
82
|
+
encoding: US-ASCII
|
83
|
+
string: ''
|
84
|
+
http_version:
|
85
|
+
recorded_at: Sat, 16 Mar 2013 05:14:21 GMT
|
86
|
+
- request:
|
87
|
+
method: get
|
88
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page_version?format=json&name=TestPage72aa8993-bc09-4010-af55-e161b64929bb
|
89
|
+
body:
|
90
|
+
encoding: US-ASCII
|
91
|
+
string: ''
|
92
|
+
headers:
|
93
|
+
Accept-Encoding:
|
94
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
95
|
+
Accept:
|
96
|
+
- ! '*/*'
|
97
|
+
User-Agent:
|
98
|
+
- Ruby
|
99
|
+
response:
|
100
|
+
status:
|
101
|
+
code: 200
|
102
|
+
message: OK
|
103
|
+
headers:
|
104
|
+
Date:
|
105
|
+
- Sat, 16 Mar 2013 05:14:53 GMT
|
106
|
+
Server:
|
107
|
+
- Apache/2.2.22 (Ubuntu)
|
108
|
+
Access-Control-Allow-Origin:
|
109
|
+
- ! '*'
|
110
|
+
Access-Control-Allow-Methods:
|
111
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
112
|
+
Transfer-Encoding:
|
113
|
+
- chunked
|
114
|
+
Content-Type:
|
115
|
+
- application/vnd.api.v1+json; charset=utf-8
|
116
|
+
body:
|
117
|
+
encoding: US-ASCII
|
118
|
+
string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
|
119
|
+
"total_count": 2}, "objects": [{"content": "<p>foo</p>", "history_comment":
|
120
|
+
null, "history_date": "2013-03-16T00:14:52.750925", "history_id": 720, "history_type":
|
121
|
+
1, "history_user": "/api/user/2", "history_user_ip": "70.89.154.169", "id":
|
122
|
+
286, "name": "TestPage72aa8993-bc09-4010-af55-e161b64929bb", "resource_uri":
|
123
|
+
"/api/page_version/720", "slug": "testpage72aa8993-bc09-4010-af55-e161b64929bb"},
|
124
|
+
{"content": "<p>Created!</p>", "history_comment": null, "history_date": "2013-03-16T00:14:52.322231",
|
125
|
+
"history_id": 719, "history_type": 0, "history_user": "/api/user/2", "history_user_ip":
|
126
|
+
"70.89.154.169", "id": 286, "name": "TestPage72aa8993-bc09-4010-af55-e161b64929bb",
|
127
|
+
"resource_uri": "/api/page_version/719", "slug": "testpage72aa8993-bc09-4010-af55-e161b64929bb"}]}'
|
128
|
+
http_version:
|
129
|
+
recorded_at: Sat, 16 Mar 2013 05:14:22 GMT
|
130
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/site/1?format=json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 16 Mar 2013 05:14:50 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.22 (Ubuntu)
|
25
|
+
Access-Control-Allow-Origin:
|
26
|
+
- ! '*'
|
27
|
+
Access-Control-Allow-Methods:
|
28
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Content-Type:
|
32
|
+
- application/vnd.api.v1+json; charset=utf-8
|
33
|
+
body:
|
34
|
+
encoding: US-ASCII
|
35
|
+
string: ! '{"domain": "example.com", "id": 1, "language_code": "en-us", "license":
|
36
|
+
"<p>Except where otherwise noted, this content is licensed under a <a rel=\"license\"
|
37
|
+
href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution
|
38
|
+
License</a>. See <a href=\"/Copyrights\">Copyrights.</p>", "name": "example.com",
|
39
|
+
"resource_uri": "/api/site/1", "signup_tos": "I agree to release my contributions
|
40
|
+
under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\"
|
41
|
+
target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise.
|
42
|
+
See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.", "time_zone":
|
43
|
+
"America/Chicago"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 16 Mar 2013 05:14:19 GMT
|
46
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,366 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/site/1?format=json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 16 Mar 2013 01:07:52 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.22 (Ubuntu)
|
25
|
+
Access-Control-Allow-Origin:
|
26
|
+
- ! '*'
|
27
|
+
Access-Control-Allow-Methods:
|
28
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Content-Type:
|
32
|
+
- application/vnd.api.v1+json; charset=utf-8
|
33
|
+
body:
|
34
|
+
encoding: US-ASCII
|
35
|
+
string: ! '{"domain": "example.com", "id": 1, "language_code": "en-us", "license":
|
36
|
+
"<p>Except where otherwise noted, this content is licensed under a <a rel=\"license\"
|
37
|
+
href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution
|
38
|
+
License</a>. See <a href=\"/Copyrights\">Copyrights.</p>", "name": "example.com",
|
39
|
+
"resource_uri": "/api/site/1", "signup_tos": "I agree to release my contributions
|
40
|
+
under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\"
|
41
|
+
target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise.
|
42
|
+
See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.", "time_zone":
|
43
|
+
"America/Chicago"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 16 Mar 2013 01:07:21 GMT
|
46
|
+
- request:
|
47
|
+
method: get
|
48
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/site?format=json&limit=1
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ''
|
52
|
+
headers:
|
53
|
+
Accept-Encoding:
|
54
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
55
|
+
Accept:
|
56
|
+
- ! '*/*'
|
57
|
+
User-Agent:
|
58
|
+
- Ruby
|
59
|
+
response:
|
60
|
+
status:
|
61
|
+
code: 200
|
62
|
+
message: OK
|
63
|
+
headers:
|
64
|
+
Date:
|
65
|
+
- Sat, 16 Mar 2013 01:07:52 GMT
|
66
|
+
Server:
|
67
|
+
- Apache/2.2.22 (Ubuntu)
|
68
|
+
Access-Control-Allow-Origin:
|
69
|
+
- ! '*'
|
70
|
+
Access-Control-Allow-Methods:
|
71
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
72
|
+
Transfer-Encoding:
|
73
|
+
- chunked
|
74
|
+
Content-Type:
|
75
|
+
- application/vnd.api.v1+json; charset=utf-8
|
76
|
+
body:
|
77
|
+
encoding: US-ASCII
|
78
|
+
string: ! '{"meta": {"limit": 1, "next": null, "offset": 0, "previous": null,
|
79
|
+
"total_count": 1}, "objects": [{"domain": "example.com", "id": 1, "language_code":
|
80
|
+
"en-us", "license": "<p>Except where otherwise noted, this content is licensed
|
81
|
+
under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\">Creative
|
82
|
+
Commons Attribution License</a>. See <a href=\"/Copyrights\">Copyrights.</p>",
|
83
|
+
"name": "example.com", "resource_uri": "/api/site/1", "signup_tos": "I agree
|
84
|
+
to release my contributions under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\"
|
85
|
+
target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise.
|
86
|
+
See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.", "time_zone":
|
87
|
+
"America/Chicago"}]}'
|
88
|
+
http_version:
|
89
|
+
recorded_at: Sat, 16 Mar 2013 01:07:21 GMT
|
90
|
+
- request:
|
91
|
+
method: get
|
92
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page?format=json&limit=1
|
93
|
+
body:
|
94
|
+
encoding: US-ASCII
|
95
|
+
string: ''
|
96
|
+
headers:
|
97
|
+
Accept-Encoding:
|
98
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
99
|
+
Accept:
|
100
|
+
- ! '*/*'
|
101
|
+
User-Agent:
|
102
|
+
- Ruby
|
103
|
+
response:
|
104
|
+
status:
|
105
|
+
code: 200
|
106
|
+
message: OK
|
107
|
+
headers:
|
108
|
+
Date:
|
109
|
+
- Sat, 16 Mar 2013 01:07:52 GMT
|
110
|
+
Server:
|
111
|
+
- Apache/2.2.22 (Ubuntu)
|
112
|
+
Access-Control-Allow-Origin:
|
113
|
+
- ! '*'
|
114
|
+
Access-Control-Allow-Methods:
|
115
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
116
|
+
Transfer-Encoding:
|
117
|
+
- chunked
|
118
|
+
Content-Type:
|
119
|
+
- application/vnd.api.v1+json; charset=utf-8
|
120
|
+
body:
|
121
|
+
encoding: ASCII-8BIT
|
122
|
+
string: !binary |-
|
123
|
+
eyJtZXRhIjogeyJsaW1pdCI6IDEsICJuZXh0IjogIi9hcGkvcGFnZT9vZmZz
|
124
|
+
ZXQ9MSZsaW1pdD0xJmxpbWl0PTEmZm9ybWF0PWpzb24iLCAib2Zmc2V0Ijog
|
125
|
+
MCwgInByZXZpb3VzIjogbnVsbCwgInRvdGFsX2NvdW50IjogNTh9LCAib2Jq
|
126
|
+
ZWN0cyI6IFt7ImNvbnRlbnQiOiAiPHRhYmxlPlxuXHQ8dGJvZHk+XG5cdFx0
|
127
|
+
PHRyPlxuXHRcdFx0PHRkIHN0eWxlPVwiYmFja2dyb3VuZC1jb2xvcjogcmdi
|
128
|
+
KDIzMiwgMjM2LCAyMzkpO1wiPlxuXHRcdFx0XHQ8c3Ryb25nPkxvY2F0aW9u
|
129
|
+
PC9zdHJvbmc+PC90ZD5cblx0XHQ8L3RyPlxuXHRcdDx0cj5cblx0XHRcdDx0
|
130
|
+
ZD5cblx0XHRcdFx0UGxlYXNlIGZpbGwgaW4gYWRkcmVzczwvdGQ+XG5c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G48L3VsPlxuPHA+XG5c
|
176
|
+
dMKgPC9wPlxuIiwgImlkIjogMSwgIm1hcCI6IG51bGwsICJuYW1lIjogIlRl
|
177
|
+
bXBsYXRlcy9CdXNpbmVzcyIsICJwYWdlX3RhZ3MiOiBudWxsLCAicmVzb3Vy
|
178
|
+
Y2VfdXJpIjogIi9hcGkvcGFnZS9UZW1wbGF0ZXMvQnVzaW5lc3MiLCAic2x1
|
179
|
+
ZyI6ICJ0ZW1wbGF0ZXMvYnVzaW5lc3MifV19
|
180
|
+
http_version:
|
181
|
+
recorded_at: Sat, 16 Mar 2013 01:07:22 GMT
|
182
|
+
- request:
|
183
|
+
method: get
|
184
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/user?format=json&limit=1
|
185
|
+
body:
|
186
|
+
encoding: US-ASCII
|
187
|
+
string: ''
|
188
|
+
headers:
|
189
|
+
Accept-Encoding:
|
190
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
191
|
+
Accept:
|
192
|
+
- ! '*/*'
|
193
|
+
User-Agent:
|
194
|
+
- Ruby
|
195
|
+
response:
|
196
|
+
status:
|
197
|
+
code: 200
|
198
|
+
message: OK
|
199
|
+
headers:
|
200
|
+
Date:
|
201
|
+
- Sat, 16 Mar 2013 01:07:53 GMT
|
202
|
+
Server:
|
203
|
+
- Apache/2.2.22 (Ubuntu)
|
204
|
+
Access-Control-Allow-Origin:
|
205
|
+
- ! '*'
|
206
|
+
Access-Control-Allow-Methods:
|
207
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
208
|
+
Transfer-Encoding:
|
209
|
+
- chunked
|
210
|
+
Content-Type:
|
211
|
+
- application/vnd.api.v1+json; charset=utf-8
|
212
|
+
body:
|
213
|
+
encoding: US-ASCII
|
214
|
+
string: ! '{"meta": {"limit": 1, "next": "/api/user?offset=1&limit=1&limit=1&format=json",
|
215
|
+
"offset": 0, "previous": null, "total_count": 10}, "objects": [{"date_joined":
|
216
|
+
"2013-02-17T01:54:39.818130", "first_name": "", "last_name": "", "resource_uri":
|
217
|
+
"", "username": "AnonymousUser"}]}'
|
218
|
+
http_version:
|
219
|
+
recorded_at: Sat, 16 Mar 2013 01:07:22 GMT
|
220
|
+
- request:
|
221
|
+
method: get
|
222
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/file?format=json&limit=1
|
223
|
+
body:
|
224
|
+
encoding: US-ASCII
|
225
|
+
string: ''
|
226
|
+
headers:
|
227
|
+
Accept-Encoding:
|
228
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
229
|
+
Accept:
|
230
|
+
- ! '*/*'
|
231
|
+
User-Agent:
|
232
|
+
- Ruby
|
233
|
+
response:
|
234
|
+
status:
|
235
|
+
code: 200
|
236
|
+
message: OK
|
237
|
+
headers:
|
238
|
+
Date:
|
239
|
+
- Sat, 16 Mar 2013 01:07:53 GMT
|
240
|
+
Server:
|
241
|
+
- Apache/2.2.22 (Ubuntu)
|
242
|
+
Access-Control-Allow-Origin:
|
243
|
+
- ! '*'
|
244
|
+
Access-Control-Allow-Methods:
|
245
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
246
|
+
Transfer-Encoding:
|
247
|
+
- chunked
|
248
|
+
Content-Type:
|
249
|
+
- application/vnd.api.v1+json; charset=utf-8
|
250
|
+
body:
|
251
|
+
encoding: US-ASCII
|
252
|
+
string: ! '{"meta": {"limit": 1, "next": null, "offset": 0, "previous": null,
|
253
|
+
"total_count": 0}, "objects": []}'
|
254
|
+
http_version:
|
255
|
+
recorded_at: Sat, 16 Mar 2013 01:07:22 GMT
|
256
|
+
- request:
|
257
|
+
method: get
|
258
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/map?format=json&limit=1
|
259
|
+
body:
|
260
|
+
encoding: US-ASCII
|
261
|
+
string: ''
|
262
|
+
headers:
|
263
|
+
Accept-Encoding:
|
264
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
265
|
+
Accept:
|
266
|
+
- ! '*/*'
|
267
|
+
User-Agent:
|
268
|
+
- Ruby
|
269
|
+
response:
|
270
|
+
status:
|
271
|
+
code: 200
|
272
|
+
message: OK
|
273
|
+
headers:
|
274
|
+
Date:
|
275
|
+
- Sat, 16 Mar 2013 01:07:53 GMT
|
276
|
+
Server:
|
277
|
+
- Apache/2.2.22 (Ubuntu)
|
278
|
+
Access-Control-Allow-Origin:
|
279
|
+
- ! '*'
|
280
|
+
Access-Control-Allow-Methods:
|
281
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
282
|
+
Transfer-Encoding:
|
283
|
+
- chunked
|
284
|
+
Content-Type:
|
285
|
+
- application/vnd.api.v1+json; charset=utf-8
|
286
|
+
body:
|
287
|
+
encoding: US-ASCII
|
288
|
+
string: ! '{"meta": {"limit": 1, "next": null, "offset": 0, "previous": null,
|
289
|
+
"total_count": 0}, "objects": []}'
|
290
|
+
http_version:
|
291
|
+
recorded_at: Sat, 16 Mar 2013 01:07:22 GMT
|
292
|
+
- request:
|
293
|
+
method: get
|
294
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/tag?format=json&limit=1
|
295
|
+
body:
|
296
|
+
encoding: US-ASCII
|
297
|
+
string: ''
|
298
|
+
headers:
|
299
|
+
Accept-Encoding:
|
300
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
301
|
+
Accept:
|
302
|
+
- ! '*/*'
|
303
|
+
User-Agent:
|
304
|
+
- Ruby
|
305
|
+
response:
|
306
|
+
status:
|
307
|
+
code: 200
|
308
|
+
message: OK
|
309
|
+
headers:
|
310
|
+
Date:
|
311
|
+
- Sat, 16 Mar 2013 01:07:53 GMT
|
312
|
+
Server:
|
313
|
+
- Apache/2.2.22 (Ubuntu)
|
314
|
+
Access-Control-Allow-Origin:
|
315
|
+
- ! '*'
|
316
|
+
Access-Control-Allow-Methods:
|
317
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
318
|
+
Transfer-Encoding:
|
319
|
+
- chunked
|
320
|
+
Content-Type:
|
321
|
+
- application/vnd.api.v1+json; charset=utf-8
|
322
|
+
body:
|
323
|
+
encoding: US-ASCII
|
324
|
+
string: ! '{"meta": {"limit": 1, "next": "/api/tag?offset=1&limit=1&limit=1&format=json",
|
325
|
+
"offset": 0, "previous": null, "total_count": 5}, "objects": [{"id": 5, "name":
|
326
|
+
"cats_test", "resource_uri": "/api/tag/cats_test", "slug": "cats_test"}]}'
|
327
|
+
http_version:
|
328
|
+
recorded_at: Sat, 16 Mar 2013 01:07:22 GMT
|
329
|
+
- request:
|
330
|
+
method: get
|
331
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/page_tags?format=json&limit=1
|
332
|
+
body:
|
333
|
+
encoding: US-ASCII
|
334
|
+
string: ''
|
335
|
+
headers:
|
336
|
+
Accept-Encoding:
|
337
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
338
|
+
Accept:
|
339
|
+
- ! '*/*'
|
340
|
+
User-Agent:
|
341
|
+
- Ruby
|
342
|
+
response:
|
343
|
+
status:
|
344
|
+
code: 200
|
345
|
+
message: OK
|
346
|
+
headers:
|
347
|
+
Date:
|
348
|
+
- Sat, 16 Mar 2013 01:07:53 GMT
|
349
|
+
Server:
|
350
|
+
- Apache/2.2.22 (Ubuntu)
|
351
|
+
Access-Control-Allow-Origin:
|
352
|
+
- ! '*'
|
353
|
+
Access-Control-Allow-Methods:
|
354
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
355
|
+
Transfer-Encoding:
|
356
|
+
- chunked
|
357
|
+
Content-Type:
|
358
|
+
- application/vnd.api.v1+json; charset=utf-8
|
359
|
+
body:
|
360
|
+
encoding: US-ASCII
|
361
|
+
string: ! '{"meta": {"limit": 1, "next": "/api/page_tags?offset=1&limit=1&limit=1&format=json",
|
362
|
+
"offset": 0, "previous": null, "total_count": 2}, "objects": [{"id": 5, "page":
|
363
|
+
"/api/page/cats", "resource_uri": "/api/page_tags/cats", "tags": []}]}'
|
364
|
+
http_version:
|
365
|
+
recorded_at: Sat, 16 Mar 2013 01:07:23 GMT
|
366
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://ec2-54-234-151-52.compute-1.amazonaws.com/api/site/1?format=json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- ! '*/*'
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 16 Mar 2013 01:07:54 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.22 (Ubuntu)
|
25
|
+
Access-Control-Allow-Origin:
|
26
|
+
- ! '*'
|
27
|
+
Access-Control-Allow-Methods:
|
28
|
+
- POST,GET,OPTIONS,PUT,DELETE
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Content-Type:
|
32
|
+
- application/vnd.api.v1+json; charset=utf-8
|
33
|
+
body:
|
34
|
+
encoding: US-ASCII
|
35
|
+
string: ! '{"domain": "example.com", "id": 1, "language_code": "en-us", "license":
|
36
|
+
"<p>Except where otherwise noted, this content is licensed under a <a rel=\"license\"
|
37
|
+
href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution
|
38
|
+
License</a>. See <a href=\"/Copyrights\">Copyrights.</p>", "name": "example.com",
|
39
|
+
"resource_uri": "/api/site/1", "signup_tos": "I agree to release my contributions
|
40
|
+
under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\"
|
41
|
+
target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise.
|
42
|
+
See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.", "time_zone":
|
43
|
+
"America/Chicago"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 16 Mar 2013 01:07:23 GMT
|
46
|
+
recorded_with: VCR 2.4.0
|
data/spec/helper.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require 'localwiki_client'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'vcr'
|
1
5
|
|
2
|
-
|
3
|
-
|
4
|
-
|
6
|
+
VCR.configure do |c|
|
7
|
+
c.cassette_library_dir = File.expand_path("fixtures/cassettes", File.dirname(__FILE__))
|
8
|
+
c.hook_into :webmock
|
9
|
+
# c.debug_logger = File.open('spec/fixtures/cassettes/debug_vcr.log', 'w')
|
10
|
+
end
|
11
|
+
|
12
|
+
unless ENV['localwiki_client_user'] && ENV['localwiki_client_apikey']
|
13
|
+
puts "\nTo add or modify tests in the spec folder you need to do two things:"
|
14
|
+
puts "\tContact sethvincent@gmail.com to request a username and apikey on the test server."
|
15
|
+
puts "\tSet these two environment variables:\n\t\texport localwiki_client_user=USERNAME\n\t\texport localwiki_client_apikey=APIKEY"
|
16
|
+
end
|
@@ -1,36 +1,42 @@
|
|
1
|
-
|
2
|
-
require 'localwiki_client'
|
3
|
-
require 'rspec/mocks'
|
4
|
-
require 'helper'
|
1
|
+
require File.expand_path("../helper", __FILE__)
|
5
2
|
|
6
|
-
describe 'LocalwikiClient
|
3
|
+
describe 'LocalwikiClient' do
|
7
4
|
|
8
|
-
|
5
|
+
before(:all) do
|
6
|
+
VCR.insert_cassette 'localwiki_client', :record => :new_episodes
|
7
|
+
@wiki = Localwiki::Client.new 'ec2-54-234-151-52.compute-1.amazonaws.com'
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
VCR.eject_cassette
|
12
|
+
end
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
context 'attributes' do
|
15
|
+
|
16
|
+
context '#site_name' do
|
17
|
+
it { @wiki.site_name.should eq 'example.com' }
|
12
18
|
end
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
response.stub(:body) { @site_fetch_json }
|
17
|
-
conn = double('conn')
|
18
|
-
Faraday.should_receive(:new
|
19
|
-
).with(
|
20
|
-
{ url: 'mockwiki.foo' }
|
21
|
-
).and_return(conn)
|
22
|
-
# Faraday::Connection.any_instance
|
23
|
-
conn.should_receive(:get
|
24
|
-
).with(
|
25
|
-
'http://mockwiki.foo/api/site/1',
|
26
|
-
{format: 'json'}
|
27
|
-
).and_return(response)
|
20
|
+
context '#time_zone' do
|
21
|
+
it { @wiki.time_zone.should eq 'America/Chicago' }
|
28
22
|
end
|
29
23
|
|
30
|
-
|
24
|
+
context '#language_code' do
|
25
|
+
it { @wiki.language_code.should eq 'en-us' }
|
26
|
+
end
|
31
27
|
|
32
|
-
context '#
|
33
|
-
it
|
28
|
+
context '#page_by_name' do
|
29
|
+
it 'returns page body'
|
30
|
+
end
|
31
|
+
|
32
|
+
%W{site page user file map tag page_tags}.each do |resource|
|
33
|
+
context "#count(#{resource})" do
|
34
|
+
it { @wiki.count(resource).should be_a Fixnum }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context '#list' do
|
39
|
+
it 'returns list of items matching'
|
34
40
|
end
|
35
41
|
|
36
42
|
end
|