discourse_plugin_statistics 0.1.0.pre3 → 0.1.0.pre4

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: e3a9895060005a6e8c1b96f19769ac296a044c8b2fee341a812f2ce8b7835c9f
4
- data.tar.gz: eff6c181bb2a24f62602e3adddc24849121173a0020b8a59a305fa65beab8e73
3
+ metadata.gz: 5ecea4649c6e62e7a516377d370b3c3eb46880c8732b1c8d03e5f3b2c05e1de4
4
+ data.tar.gz: c81cd9627a8935c9b9fbbff145e49171f20465776c736c32bfb0d11770000c87
5
5
  SHA512:
6
- metadata.gz: 4bb597a6df5115c7c4da006bebb2df26df9ac26b2a9ddd35266c9862737672b474c9e21475f1fc54f75f58840a145fa2b161dc7a724524d8be095c6f8231780b
7
- data.tar.gz: 547c05922a453ebaa6d5ced40ce8cabf256ca0210d1a71f84a44214de34ce9bcff1001000abcbe83904457ecbea7a4084db0750f45383bec5dc64d63f1a00759
6
+ metadata.gz: e9e5edc1aa1add98a8348b42e3c532832814ee6b96ea327de04abfa770f8ca95b4f83323e6be3f61e64e361ea1ca2e6415301eb717a84c2156742d00be6b72f6
7
+ data.tar.gz: '079f5357ab3e37b2b6923fa6b122ad2d77e20cae5e5a08a551bc526009754f0c90b4e6c10e55027331ded6ed4345503342a30b724887bc5722c66a13df26c131'
@@ -9,19 +9,32 @@ module DiscoursePluginStatistics
9
9
  end
10
10
 
11
11
  def update
12
+ body = {
13
+ discourse: discourse,
14
+ plugins: plugins
15
+ }.to_json
16
+
17
+ response = request(body)
18
+
19
+ if response && [301, 302, 303].include?(response[:status])
20
+ location = response[:headers]["Location"]
21
+ response = request(body, location) if location
22
+ end
23
+
24
+ response
25
+ end
26
+
27
+ protected
28
+
29
+ def request(body, url = nil)
12
30
  ::Excon.post(
13
- DiscoursePluginStatistics.server_url,
31
+ url || DiscoursePluginStatistics.server_url,
14
32
  headers: { "Content-Type" => "application/json" },
15
- body: {
16
- discourse: discourse,
17
- plugins: plugins
18
- }.to_json
33
+ body: body
19
34
  )
20
35
  rescue Excon::Error
21
36
  end
22
37
 
23
- protected
24
-
25
38
  def discourse
26
39
  @discourse ||= DiscoursePluginStatistics::Discourse.new.json
27
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscoursePluginStatistics
4
- VERSION = "0.1.0.pre3"
4
+ VERSION = "0.1.0.pre4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse_plugin_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre3
4
+ version: 0.1.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-04 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers