discourse_api 0.18.0 → 0.19.0

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: c30c8d6075c413eb4eb59d301ef84df97e09bb02
4
- data.tar.gz: c9d564671e6b060d7c220e075f78f8459c6e1338
3
+ metadata.gz: 83abc19a3d7e268f4e7bbed2ba58af029149bf8f
4
+ data.tar.gz: a355175ab4498a2d02f2cbb340b48987770882ba
5
5
  SHA512:
6
- metadata.gz: fee2ef5f539d1ab91009f220dd25427dbe5e91afabb9e5b079d1bef32715a4f8f1151a11cd1ee5783e8523438a9dc3e343e9b61da5ea3495513ce379091f3e94
7
- data.tar.gz: ae8ad784a1d21fed5e4142763e759534243567c472fbcaac325d9d6988eae24d233f965aed03580db860161b8730da25a6dcec11e9250c245460819b703172ae
6
+ metadata.gz: 5db56a7d1101b1568cd51e52dee5df79651697c11f84c83e9b5c4e7c73336689e34a8e0ea1e6eb72f082c6efb6e61056b2ce5ac6c732acb355aff6a9044c0781
7
+ data.tar.gz: 98317ae29f5fc092f5126f988d35c73e29eb46baab5264fab7dd7e96fa6b73b643dd558121d5ef003736a2dd7c2d2beba22e0e3e5cf88c976a75b78cb760f1a5
@@ -2,6 +2,10 @@
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.19.0] - 2017-11-22
6
+ ### Added
7
+ - Added optional `create_post` params
8
+
5
9
  ## [0.18.0] - 2017-10-17
6
10
  ### Added
7
11
  - Added update_group API call
@@ -62,6 +62,11 @@ module DiscourseApi
62
62
  response.body
63
63
  end
64
64
 
65
+ def group(group_name)
66
+ response = get("/groups/#{group_name}.json")
67
+ response.body
68
+ end
69
+
65
70
  def group_add(group_id, users)
66
71
  users.keys.each do |key|
67
72
  # Accept arrays and convert to comma-delimited string.
@@ -4,6 +4,7 @@ module DiscourseApi
4
4
  def create_post(args)
5
5
  args = API.params(args)
6
6
  .required(:topic_id, :raw)
7
+ .optional(:created_at, :api_username)
7
8
  post("/posts", args)
8
9
  end
9
10
 
@@ -1,3 +1,3 @@
1
1
  module DiscourseApi
2
- VERSION = "0.18.0"
2
+ VERSION = "0.19.0"
3
3
  end
@@ -19,6 +19,12 @@ describe DiscourseApi::API::Groups do
19
19
  groups.each { |g| expect(g).to be_a Hash }
20
20
  end
21
21
 
22
+ it "returns a single group" do
23
+ stub_get("http://localhost:3000/groups/some-group.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("group.json"), headers: { content_type: "application/json" })
24
+ group = subject.group('some-group')
25
+ expect(group['basic_group']).to be_a Hash
26
+ end
27
+
22
28
  it "create new groups" do
23
29
  stub_post("http://localhost:3000/admin/groups?api_key=test_d7fd0429940&api_username=test_user")
24
30
  subject.create_group(name: "test_group")
@@ -0,0 +1,9 @@
1
+ {"basic_group": {
2
+ "id": 101,
3
+ "name": "group_1",
4
+ "user_count": 17,
5
+ "automatic": false,
6
+ "alias_level": 0,
7
+ "visible": true
8
+ }
9
+ }
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.18.0
4
+ version: 0.19.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: 2017-10-17 00:00:00.000000000 Z
14
+ date: 2017-11-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -257,6 +257,7 @@ files:
257
257
  - spec/fixtures/email_settings.json
258
258
  - spec/fixtures/generate_api_key.json
259
259
  - spec/fixtures/generate_master_key.json
260
+ - spec/fixtures/group.json
260
261
  - spec/fixtures/groups.json
261
262
  - spec/fixtures/hot.json
262
263
  - spec/fixtures/latest.json
@@ -338,6 +339,7 @@ test_files:
338
339
  - spec/fixtures/email_settings.json
339
340
  - spec/fixtures/generate_api_key.json
340
341
  - spec/fixtures/generate_master_key.json
342
+ - spec/fixtures/group.json
341
343
  - spec/fixtures/groups.json
342
344
  - spec/fixtures/hot.json
343
345
  - spec/fixtures/latest.json