discourse_api 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +23 -10
  3. data/.rubocop.yml +1 -1
  4. data/.streerc +2 -0
  5. data/CHANGELOG.md +10 -0
  6. data/Gemfile +1 -1
  7. data/README.md +0 -4
  8. data/discourse_api.gemspec +7 -4
  9. data/examples/backups.rb +5 -5
  10. data/examples/badges.rb +5 -5
  11. data/examples/bookmark_topic.rb +5 -5
  12. data/examples/category.rb +10 -6
  13. data/examples/change_topic_status.rb +12 -11
  14. data/examples/create_private_message.rb +6 -6
  15. data/examples/create_topic.rb +9 -9
  16. data/examples/create_update_category.rb +13 -16
  17. data/examples/create_user.rb +12 -11
  18. data/examples/dashboard.rb +5 -5
  19. data/examples/disposable_invite_tokens.rb +9 -10
  20. data/examples/example.rb +5 -5
  21. data/examples/group_set_user_notification_level.rb +18 -19
  22. data/examples/groups.rb +7 -7
  23. data/examples/invite_users.rb +5 -5
  24. data/examples/manage_api_keys.rb +6 -11
  25. data/examples/notifications.rb +6 -6
  26. data/examples/polls.rb +12 -12
  27. data/examples/post_action.rb +5 -5
  28. data/examples/search.rb +5 -5
  29. data/examples/sent_private_messages.rb +6 -6
  30. data/examples/sso.rb +6 -6
  31. data/examples/topic_lists.rb +5 -5
  32. data/examples/update_user.rb +15 -7
  33. data/examples/upload_file.rb +7 -7
  34. data/lib/discourse_api/api/api_key.rb +1 -3
  35. data/lib/discourse_api/api/backups.rb +1 -1
  36. data/lib/discourse_api/api/badges.rb +21 -6
  37. data/lib/discourse_api/api/categories.rb +69 -37
  38. data/lib/discourse_api/api/dashboard.rb +2 -6
  39. data/lib/discourse_api/api/groups.rb +68 -73
  40. data/lib/discourse_api/api/invite.rb +30 -30
  41. data/lib/discourse_api/api/notifications.rb +2 -3
  42. data/lib/discourse_api/api/params.rb +4 -14
  43. data/lib/discourse_api/api/polls.rb +9 -12
  44. data/lib/discourse_api/api/posts.rb +5 -8
  45. data/lib/discourse_api/api/private_messages.rb +9 -8
  46. data/lib/discourse_api/api/search.rb +2 -2
  47. data/lib/discourse_api/api/topics.rb +20 -22
  48. data/lib/discourse_api/api/uploads.rb +7 -5
  49. data/lib/discourse_api/api/user_actions.rb +2 -2
  50. data/lib/discourse_api/api/users.rb +31 -19
  51. data/lib/discourse_api/client.rb +58 -56
  52. data/lib/discourse_api/example_helper.rb +2 -4
  53. data/lib/discourse_api/single_sign_on.rb +56 -57
  54. data/lib/discourse_api/version.rb +1 -1
  55. data/spec/discourse_api/api/api_key_spec.rb +39 -25
  56. data/spec/discourse_api/api/backups_spec.rb +8 -3
  57. data/spec/discourse_api/api/badges_spec.rb +17 -7
  58. data/spec/discourse_api/api/categories_spec.rb +95 -53
  59. data/spec/discourse_api/api/email_spec.rb +17 -7
  60. data/spec/discourse_api/api/groups_spec.rb +71 -52
  61. data/spec/discourse_api/api/invite_spec.rb +41 -21
  62. data/spec/discourse_api/api/notifications_spec.rb +8 -4
  63. data/spec/discourse_api/api/params_spec.rb +5 -3
  64. data/spec/discourse_api/api/polls_spec.rb +53 -44
  65. data/spec/discourse_api/api/posts_spec.rb +33 -16
  66. data/spec/discourse_api/api/private_messages_spec.rb +25 -12
  67. data/spec/discourse_api/api/search_spec.rb +8 -3
  68. data/spec/discourse_api/api/site_settings_spec.rb +2 -3
  69. data/spec/discourse_api/api/sso_spec.rb +29 -25
  70. data/spec/discourse_api/api/topics_spec.rb +100 -31
  71. data/spec/discourse_api/api/uploads_spec.rb +16 -7
  72. data/spec/discourse_api/api/user_actions_spec.rb +13 -3
  73. data/spec/discourse_api/api/users_spec.rb +137 -55
  74. data/spec/discourse_api/client_spec.rb +32 -32
  75. data/spec/discourse_api/single_sign_on_spec.rb +43 -0
  76. data/spec/fixtures/categories.json +1 -1
  77. data/spec/spec_helper.rb +10 -15
  78. metadata +57 -12
data/spec/spec_helper.rb CHANGED
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
- require 'simplecov'
2
+ require "simplecov"
3
3
 
4
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
5
- SimpleCov::Formatter::HTMLFormatter
6
- ])
4
+ SimpleCov.formatter =
5
+ SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter])
7
6
 
8
- SimpleCov.start do
9
- add_filter "/spec/"
10
- end
7
+ SimpleCov.start { add_filter "/spec/" }
11
8
 
12
- require 'discourse_api'
13
- require 'rspec'
14
- require 'webmock/rspec'
9
+ require "discourse_api"
10
+ require "rspec"
11
+ require "webmock/rspec"
15
12
 
16
13
  RSpec.configure do |config|
17
14
  config.expect_with :rspec do |c|
@@ -22,7 +19,7 @@ end
22
19
  WebMock.disable_net_connect!(allow_localhost: true)
23
20
 
24
21
  def host
25
- 'http://localhost:3000'
22
+ "http://localhost:3000"
26
23
  end
27
24
 
28
25
  def a_delete(path)
@@ -62,11 +59,9 @@ def fixture_path
62
59
  end
63
60
 
64
61
  def fixture(file)
65
- File.new(fixture_path + '/' + file)
62
+ File.new(fixture_path + "/" + file)
66
63
  end
67
64
 
68
65
  def escape_params(params)
69
- params.map do |key, value|
70
- [CGI.escape(key), value].join('=')
71
- end.join('&')
66
+ params.map { |key, value| [CGI.escape(key), value].join("=") }.join("&")
72
67
  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: 1.0.0
4
+ version: 2.0.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: 2022-05-02 00:00:00.000000000 Z
14
+ date: 2023-05-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -19,28 +19,42 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.0'
22
+ version: '2.7'
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: '1.0'
29
+ version: '2.7'
30
30
  - !ruby/object:Gem::Dependency
31
- name: faraday_middleware
31
+ name: faraday-follow_redirects
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: '1.0'
36
+ version: '0'
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: '1.0'
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: faraday-multipart
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
44
58
  - !ruby/object:Gem::Dependency
45
59
  name: rack
46
60
  requirement: !ruby/object:Gem::Requirement
@@ -173,14 +187,42 @@ dependencies:
173
187
  requirements:
174
188
  - - "~>"
175
189
  - !ruby/object:Gem::Version
176
- version: 2.5.0
190
+ version: 3.2.0
191
+ type: :development
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: 3.2.0
198
+ - !ruby/object:Gem::Dependency
199
+ name: syntax_tree
200
+ requirement: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: 6.1.1
205
+ type: :development
206
+ prerelease: false
207
+ version_requirements: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - "~>"
210
+ - !ruby/object:Gem::Version
211
+ version: 6.1.1
212
+ - !ruby/object:Gem::Dependency
213
+ name: syntax_tree-disable_ternary
214
+ requirement: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - "~>"
217
+ - !ruby/object:Gem::Version
218
+ version: 1.0.0
177
219
  type: :development
178
220
  prerelease: false
179
221
  version_requirements: !ruby/object:Gem::Requirement
180
222
  requirements:
181
223
  - - "~>"
182
224
  - !ruby/object:Gem::Version
183
- version: 2.5.0
225
+ version: 1.0.0
184
226
  description: Discourse API
185
227
  email:
186
228
  - sam.saffron@gmail.com
@@ -194,6 +236,7 @@ files:
194
236
  - ".github/workflows/ci.yml"
195
237
  - ".gitignore"
196
238
  - ".rubocop.yml"
239
+ - ".streerc"
197
240
  - CHANGELOG.md
198
241
  - Gemfile
199
242
  - Guardfile
@@ -274,6 +317,7 @@ files:
274
317
  - spec/discourse_api/api/user_actions_spec.rb
275
318
  - spec/discourse_api/api/users_spec.rb
276
319
  - spec/discourse_api/client_spec.rb
320
+ - spec/discourse_api/single_sign_on_spec.rb
277
321
  - spec/fixtures/admin_user.json
278
322
  - spec/fixtures/api_key.json
279
323
  - spec/fixtures/backups.json
@@ -340,7 +384,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
384
  requirements:
341
385
  - - ">="
342
386
  - !ruby/object:Gem::Version
343
- version: 2.6.0
387
+ version: 2.7.0
344
388
  required_rubygems_version: !ruby/object:Gem::Requirement
345
389
  requirements:
346
390
  - - ">="
@@ -372,6 +416,7 @@ test_files:
372
416
  - spec/discourse_api/api/user_actions_spec.rb
373
417
  - spec/discourse_api/api/users_spec.rb
374
418
  - spec/discourse_api/client_spec.rb
419
+ - spec/discourse_api/single_sign_on_spec.rb
375
420
  - spec/fixtures/admin_user.json
376
421
  - spec/fixtures/api_key.json
377
422
  - spec/fixtures/backups.json