discourse_api 0.30.0 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5afa6693c3b93d59f924c6d2bc56e0577ce1a3316699e95746d8001613aba868
4
- data.tar.gz: 4e059fd5647fa035e0c893df2dfc7e561d4fba412eb8a5a1c349ac9feb1549ca
3
+ metadata.gz: dbdfe96da34bba86f5ce76180d61e442e368ab0a5264188c60c893d30e485e27
4
+ data.tar.gz: 107d25837187abc721710043a6ca35c59a5d4fa28431f9f3c3c7c3fbe350c3eb
5
5
  SHA512:
6
- metadata.gz: 40f8264e3b6d5ba9ec4165f2b4bb6143acce3621135b5dde2fb376bf06f544d158f6596cb9d6b69df6e653ad239ca988fe5a14b0c2a80d274e9fdeadd4849c6b
7
- data.tar.gz: 18222305403f41ab22dfb35aa076b5eaeb60a0839c490de093dfddc99c1419ea2101a1f51209ae52300330ca62b12a733e04fafde42d201bfbb041a59aece7dc
6
+ metadata.gz: 96358eb77b7f4b083abef89c1048b0b2ba1f81cd1e64460ca978730f884e00584d2589cefa590b8f45611ca478b692d4a92ce8b9dbdeeb31360913cb31fe4981
7
+ data.tar.gz: 1d9ac7f182197efd003a3a98487359d09cec4f50091c56903f01b197de53e84bef06b96c0f3053d2fb8325b1f95bdc9c39942826f4bd48925c11808444856bea
@@ -2,6 +2,11 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.31.0] - 2019-02-07
6
+ ### Added
7
+ - Added `deactivate` method
8
+ - Added 201 and 204 as valid POST responses
9
+
5
10
  ## [0.30.0] - 2018-12-19
6
11
  ### Added
7
12
  - Add params hash to `list_users`
@@ -97,6 +97,10 @@ module DiscourseApi
97
97
  response = get("/users/check_username.json?username=#{CGI.escape(username)}")
98
98
  response[:body]
99
99
  end
100
+
101
+ def deactivate(user_id)
102
+ put("/admin/users/#{user_id}/deactivate")
103
+ end
100
104
  end
101
105
  end
102
106
  end
@@ -86,7 +86,7 @@ module DiscourseApi
86
86
  def post(path, params={})
87
87
  response = request(:post, path, params)
88
88
  case response.status
89
- when 200
89
+ when 200, 201, 204
90
90
  response.body
91
91
  else
92
92
  raise DiscourseApi::Error, response.body
@@ -1,3 +1,3 @@
1
1
  module DiscourseApi
2
- VERSION = "0.30.0"
2
+ VERSION = "0.31.0"
3
3
  end
@@ -318,4 +318,20 @@ describe DiscourseApi::API::Users do
318
318
  end
319
319
  end
320
320
  end
321
+
322
+ describe "#deactivate" do
323
+ before do
324
+ stub_put("http://localhost:3000/admin/users/15/deactivate?api_key=test_d7fd0429940&api_username=test_user").to_return(body: nil)
325
+ end
326
+
327
+ it "makes the put request" do
328
+ subject.deactivate(15)
329
+ expect(a_put("http://localhost:3000/admin/users/15/deactivate?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
330
+ end
331
+
332
+ it "returns success" do
333
+ response = subject.deactivate(15)
334
+ expect(response.status).to eq(200)
335
+ end
336
+ end
321
337
  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.30.0
4
+ version: 0.31.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: 2018-12-19 00:00:00.000000000 Z
14
+ date: 2019-02-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday