discourse_api 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +21 -21
- data/.travis.yml +5 -7
- data/CHANGELOG.md +99 -85
- data/Gemfile +4 -4
- data/Guardfile +5 -5
- data/LICENSE.txt +22 -22
- data/README.md +73 -73
- data/Rakefile +7 -7
- data/discourse_api.gemspec +35 -33
- data/examples/backups.rb +18 -18
- data/examples/category.rb +21 -21
- data/examples/change_topic_status.rb +33 -0
- data/examples/create_topic.rb +23 -23
- data/examples/create_user.rb +14 -14
- data/examples/dashboard.rb +13 -13
- data/examples/disposable_invite_tokens.rb +18 -18
- data/examples/example.rb +9 -9
- data/examples/groups.rb +25 -25
- data/examples/invite_users.rb +15 -15
- data/examples/post_action.rb +25 -25
- data/examples/search.rb +9 -9
- data/examples/sso.rb +14 -14
- data/examples/topic_lists.rb +15 -15
- data/examples/update_user.rb +22 -22
- data/lib/discourse_api.rb +5 -5
- data/lib/discourse_api/api/api_key.rb +31 -31
- data/lib/discourse_api/api/backups.rb +24 -24
- data/lib/discourse_api/api/badges.rb +28 -28
- data/lib/discourse_api/api/categories.rb +57 -57
- data/lib/discourse_api/api/dashboard.rb +24 -24
- data/lib/discourse_api/api/email.rb +15 -15
- data/lib/discourse_api/api/groups.rb +52 -52
- data/lib/discourse_api/api/invite.rb +17 -17
- data/lib/discourse_api/api/notifications.rb +9 -9
- data/lib/discourse_api/api/params.rb +55 -55
- data/lib/discourse_api/api/posts.rb +41 -42
- data/lib/discourse_api/api/private_messages.rb +10 -10
- data/lib/discourse_api/api/search.rb +19 -19
- data/lib/discourse_api/api/sso.rb +22 -22
- data/lib/discourse_api/api/tags.rb +10 -10
- data/lib/discourse_api/api/topics.rb +78 -65
- data/lib/discourse_api/api/users.rb +85 -85
- data/lib/discourse_api/client.rb +133 -133
- data/lib/discourse_api/error.rb +17 -17
- data/lib/discourse_api/single_sign_on.rb +110 -110
- data/lib/discourse_api/version.rb +3 -3
- data/routes.txt +203 -203
- data/spec/discourse_api/api/api_key_spec.rb +121 -121
- data/spec/discourse_api/api/backups_spec.rb +23 -23
- data/spec/discourse_api/api/badges_spec.rb +40 -40
- data/spec/discourse_api/api/categories_spec.rb +87 -87
- data/spec/discourse_api/api/email_spec.rb +39 -39
- data/spec/discourse_api/api/groups_spec.rb +94 -94
- data/spec/discourse_api/api/notifications_spec.rb +24 -24
- data/spec/discourse_api/api/params_spec.rb +32 -32
- data/spec/discourse_api/api/posts_spec.rb +41 -29
- data/spec/discourse_api/api/private_messages_spec.rb +22 -22
- data/spec/discourse_api/api/search_spec.rb +30 -30
- data/spec/discourse_api/api/sso_spec.rb +16 -16
- data/spec/discourse_api/api/topics_spec.rb +113 -113
- data/spec/discourse_api/api/users_spec.rb +227 -227
- data/spec/discourse_api/client_spec.rb +115 -115
- data/spec/fixtures/api.json +12 -12
- data/spec/fixtures/backups.json +12 -12
- data/spec/fixtures/badges.json +569 -569
- data/spec/fixtures/categories.json +72 -72
- data/spec/fixtures/category_latest_topics.json +92 -92
- data/spec/fixtures/category_topics.json +91 -91
- data/spec/fixtures/email_list_all.json +749 -749
- data/spec/fixtures/email_settings.json +13 -13
- data/spec/fixtures/generate_api_key.json +12 -12
- data/spec/fixtures/generate_master_key.json +7 -7
- data/spec/fixtures/groups.json +18 -18
- data/spec/fixtures/hot.json +113 -113
- data/spec/fixtures/latest.json +115 -115
- data/spec/fixtures/members_0.json +403 -403
- data/spec/fixtures/members_1.json +363 -363
- data/spec/fixtures/new.json +113 -113
- data/spec/fixtures/notifications.json +16 -16
- data/spec/fixtures/post.json +94 -94
- data/spec/fixtures/post_action_users.json +18 -0
- data/spec/fixtures/private_messages.json +69 -69
- data/spec/fixtures/regenerate_api_key.json +7 -7
- data/spec/fixtures/search.json +24 -24
- data/spec/fixtures/topic.json +739 -739
- data/spec/fixtures/topic_invite_user.json +3 -3
- data/spec/fixtures/topics_created_by.json +49 -49
- data/spec/fixtures/update_trust_level.json +37 -37
- data/spec/fixtures/upload_avatar.json +13 -13
- data/spec/fixtures/user.json +65 -65
- data/spec/fixtures/user_activate_success.json +3 -3
- data/spec/fixtures/user_badges.json +170 -170
- data/spec/fixtures/user_create_success.json +5 -5
- data/spec/fixtures/user_grant_admin.json +37 -37
- data/spec/fixtures/user_list.json +583 -583
- data/spec/fixtures/user_log_out_success.json +3 -3
- data/spec/fixtures/user_update_avatar_success.json +3 -3
- data/spec/fixtures/user_update_user.json +3 -3
- data/spec/fixtures/user_update_username.json +4 -4
- data/spec/spec_helper.rb +61 -61
- metadata +31 -28
@@ -1,3 +1,3 @@
|
|
1
|
-
{
|
2
|
-
"success": "OK"
|
3
|
-
}
|
1
|
+
{
|
2
|
+
"success": "OK"
|
3
|
+
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
{
|
2
|
-
"success": "OK"
|
3
|
-
}
|
1
|
+
{
|
2
|
+
"success": "OK"
|
3
|
+
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
{
|
2
|
-
"success": true
|
3
|
-
}
|
1
|
+
{
|
2
|
+
"success": true
|
3
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
{
|
2
|
-
"id": 7,
|
3
|
-
"username": "fake_user_2"
|
4
|
-
}
|
1
|
+
{
|
2
|
+
"id": 7,
|
3
|
+
"username": "fake_user_2"
|
4
|
+
}
|
data/spec/spec_helper.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
4
|
-
SimpleCov::Formatter::HTMLFormatter
|
5
|
-
])
|
6
|
-
|
7
|
-
SimpleCov.start do
|
8
|
-
add_filter "/spec/"
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'discourse_api'
|
12
|
-
require 'rspec'
|
13
|
-
require 'webmock/rspec'
|
14
|
-
|
15
|
-
RSpec.configure do |config|
|
16
|
-
config.expect_with :rspec do |c|
|
17
|
-
c.syntax = :expect
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
WebMock.disable_net_connect!(:allow_localhost => true)
|
22
|
-
|
23
|
-
def a_delete(path)
|
24
|
-
a_request(:delete, path)
|
25
|
-
end
|
26
|
-
|
27
|
-
def a_get(path)
|
28
|
-
a_request(:get, path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def a_post(path)
|
32
|
-
a_request(:post, path)
|
33
|
-
end
|
34
|
-
|
35
|
-
def a_put(path)
|
36
|
-
a_request(:put, path)
|
37
|
-
end
|
38
|
-
|
39
|
-
def stub_delete(path)
|
40
|
-
stub_request(:delete, path)
|
41
|
-
end
|
42
|
-
|
43
|
-
def stub_get(path)
|
44
|
-
stub_request(:get, path)
|
45
|
-
end
|
46
|
-
|
47
|
-
def stub_post(path)
|
48
|
-
stub_request(:post, path)
|
49
|
-
end
|
50
|
-
|
51
|
-
def stub_put(path)
|
52
|
-
stub_request(:put, path)
|
53
|
-
end
|
54
|
-
|
55
|
-
def fixture_path
|
56
|
-
File.expand_path("../fixtures", __FILE__)
|
57
|
-
end
|
58
|
-
|
59
|
-
def fixture(file)
|
60
|
-
File.new(fixture_path + '/' + file)
|
61
|
-
end
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
4
|
+
SimpleCov::Formatter::HTMLFormatter
|
5
|
+
])
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter "/spec/"
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'discourse_api'
|
12
|
+
require 'rspec'
|
13
|
+
require 'webmock/rspec'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |c|
|
17
|
+
c.syntax = :expect
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
WebMock.disable_net_connect!(:allow_localhost => true)
|
22
|
+
|
23
|
+
def a_delete(path)
|
24
|
+
a_request(:delete, path)
|
25
|
+
end
|
26
|
+
|
27
|
+
def a_get(path)
|
28
|
+
a_request(:get, path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def a_post(path)
|
32
|
+
a_request(:post, path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def a_put(path)
|
36
|
+
a_request(:put, path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def stub_delete(path)
|
40
|
+
stub_request(:delete, path)
|
41
|
+
end
|
42
|
+
|
43
|
+
def stub_get(path)
|
44
|
+
stub_request(:get, path)
|
45
|
+
end
|
46
|
+
|
47
|
+
def stub_post(path)
|
48
|
+
stub_request(:post, path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def stub_put(path)
|
52
|
+
stub_request(:put, path)
|
53
|
+
end
|
54
|
+
|
55
|
+
def fixture_path
|
56
|
+
File.expand_path("../fixtures", __FILE__)
|
57
|
+
end
|
58
|
+
|
59
|
+
def fixture(file)
|
60
|
+
File.new(fixture_path + '/' + file)
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-09-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -19,126 +19,126 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9
|
22
|
+
version: '0.9'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.9
|
29
|
+
version: '0.9'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: faraday_middleware
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '0.
|
36
|
+
version: '0.10'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
43
|
+
version: '0.10'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: rack
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '1.
|
50
|
+
version: '1.6'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - "
|
55
|
+
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '1.
|
57
|
+
version: '1.6'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '1.
|
64
|
+
version: '1.12'
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '1.
|
71
|
+
version: '1.12'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: rake
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: '11.1'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '11.1'
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: rspec
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '3.
|
92
|
+
version: '3.4'
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '3.
|
99
|
+
version: '3.4'
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: webmock
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
106
|
+
version: '2.0'
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
113
|
+
version: '2.0'
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: guard-rspec
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: '4.
|
120
|
+
version: '4.7'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: '4.
|
127
|
+
version: '4.7'
|
128
128
|
- !ruby/object:Gem::Dependency
|
129
129
|
name: guard
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '2.
|
134
|
+
version: '2.14'
|
135
135
|
type: :development
|
136
136
|
prerelease: false
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
139
|
- - "~>"
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '2.
|
141
|
+
version: '2.14'
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
143
|
name: rb-inotify
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,14 +159,14 @@ dependencies:
|
|
159
159
|
requirements:
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '0.
|
162
|
+
version: '0.11'
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - "~>"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '0.
|
169
|
+
version: '0.11'
|
170
170
|
description: Discourse API
|
171
171
|
email:
|
172
172
|
- sam.saffron@gmail.com
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- discourse_api.gemspec
|
189
189
|
- examples/backups.rb
|
190
190
|
- examples/category.rb
|
191
|
+
- examples/change_topic_status.rb
|
191
192
|
- examples/create_topic.rb
|
192
193
|
- examples/create_user.rb
|
193
194
|
- examples/dashboard.rb
|
@@ -256,6 +257,7 @@ files:
|
|
256
257
|
- spec/fixtures/new.json
|
257
258
|
- spec/fixtures/notifications.json
|
258
259
|
- spec/fixtures/post.json
|
260
|
+
- spec/fixtures/post_action_users.json
|
259
261
|
- spec/fixtures/private_messages.json
|
260
262
|
- spec/fixtures/regenerate_api_key.json
|
261
263
|
- spec/fixtures/search.json
|
@@ -287,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
289
|
requirements:
|
288
290
|
- - ">="
|
289
291
|
- !ruby/object:Gem::Version
|
290
|
-
version:
|
292
|
+
version: 2.2.3
|
291
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
294
|
requirements:
|
293
295
|
- - ">="
|
@@ -295,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
297
|
version: '0'
|
296
298
|
requirements: []
|
297
299
|
rubyforge_project:
|
298
|
-
rubygems_version: 2.
|
300
|
+
rubygems_version: 2.5.1
|
299
301
|
signing_key:
|
300
302
|
specification_version: 4
|
301
303
|
summary: Allows access to the Discourse API
|
@@ -333,6 +335,7 @@ test_files:
|
|
333
335
|
- spec/fixtures/new.json
|
334
336
|
- spec/fixtures/notifications.json
|
335
337
|
- spec/fixtures/post.json
|
338
|
+
- spec/fixtures/post_action_users.json
|
336
339
|
- spec/fixtures/private_messages.json
|
337
340
|
- spec/fixtures/regenerate_api_key.json
|
338
341
|
- spec/fixtures/search.json
|