discourse_plugin_statistics 0.1.0.pre2 → 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: b6cc9bb4c35ece6771cd3aa1dcbafc424d37153eb93648fe2f63a982f42fde81
4
- data.tar.gz: 6f433bb74a73645774ac99eebbcf97938056c7ede13b457226fb755c93c416e0
3
+ metadata.gz: 5ecea4649c6e62e7a516377d370b3c3eb46880c8732b1c8d03e5f3b2c05e1de4
4
+ data.tar.gz: c81cd9627a8935c9b9fbbff145e49171f20465776c736c32bfb0d11770000c87
5
5
  SHA512:
6
- metadata.gz: bee1252c734ec14dba5b916a33d4914cd3a84a5b50d35abf030033df01359fc007a0a2ad64e79a5406de203ac2473c3263b9e5dcdc5d3a6c5f073d6aab253f69
7
- data.tar.gz: cc0e763182090e6ec8c688db97e4d40ca44b8afc98e2d0e8854ba31e5e474106edd1270c0937fb3baa7a9d8464545b6ca357c9e1581bc72ecde9b7aeef9d7712
6
+ metadata.gz: e9e5edc1aa1add98a8348b42e3c532832814ee6b96ea327de04abfa770f8ca95b4f83323e6be3f61e64e361ea1ca2e6415301eb717a84c2156742d00be6b72f6
7
+ data.tar.gz: '079f5357ab3e37b2b6923fa6b122ad2d77e20cae5e5a08a551bc526009754f0c90b4e6c10e55027331ded6ed4345503342a30b724887bc5722c66a13df26c131'
@@ -9,18 +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
  )
35
+ rescue Excon::Error
20
36
  end
21
37
 
22
- protected
23
-
24
38
  def discourse
25
39
  @discourse ||= DiscoursePluginStatistics::Discourse.new.json
26
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscoursePluginStatistics
4
- VERSION = "0.1.0.pre2"
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.pre2
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