discourse_plugin_statistics 0.1.0.pre3 → 0.1.0.pre5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0ae8228274c7608227e6f43cde59bfcc1ba9439e84700327046b2be31358912
|
4
|
+
data.tar.gz: f2647b45ff91752b9cfb34e7835f50e01241cbc582e5ab2a856590d1b7d0f0af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b52b0cdeade6fdd80fd71b3b736ed345cde720817b231440b5600c44491b0e6f56b9c98331341a702fb9d95bb1eb1b9357aadc27abbc9df41ca052e9f4812f
|
7
|
+
data.tar.gz: 833048742be89bbc38c210b2633615584158fcef8038a23f63d739249efacb68c899a333a3e3110a3b32152ffade04277cd68763ef65588911c87664fbfdfdff
|
@@ -4,24 +4,39 @@ require "excon"
|
|
4
4
|
|
5
5
|
module DiscoursePluginStatistics
|
6
6
|
class Statistics
|
7
|
+
PATH = "plugin-manager/statistics"
|
8
|
+
|
7
9
|
def self.update!
|
8
10
|
new.update
|
9
11
|
end
|
10
12
|
|
11
13
|
def update
|
14
|
+
body = {
|
15
|
+
discourse: discourse,
|
16
|
+
plugins: plugins
|
17
|
+
}.to_json
|
18
|
+
|
19
|
+
response = request(body)
|
20
|
+
|
21
|
+
if response && [301, 302, 303].include?(response[:status])
|
22
|
+
location = response[:headers]["Location"]
|
23
|
+
response = request(body, location) if location
|
24
|
+
end
|
25
|
+
|
26
|
+
response
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def request(body, url = nil)
|
12
32
|
::Excon.post(
|
13
|
-
DiscoursePluginStatistics.server_url,
|
33
|
+
url || "#{DiscoursePluginStatistics.server_url}/#{PATH}",
|
14
34
|
headers: { "Content-Type" => "application/json" },
|
15
|
-
body:
|
16
|
-
discourse: discourse,
|
17
|
-
plugins: plugins
|
18
|
-
}.to_json
|
35
|
+
body: body
|
19
36
|
)
|
20
37
|
rescue Excon::Error
|
21
38
|
end
|
22
39
|
|
23
|
-
protected
|
24
|
-
|
25
40
|
def discourse
|
26
41
|
@discourse ||= DiscoursePluginStatistics::Discourse.new.json
|
27
42
|
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.
|
4
|
+
version: 0.1.0.pre5
|
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-
|
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
|