discourse_subscription_client 0.1.0.pre13 → 0.1.0.pre15
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f15b1e42f02b3159c039b28fdf1985170db6defce594f2e42c1a52f4504db3ee
|
4
|
+
data.tar.gz: 201f6f0740e215e96a288a48ac2438c501ecb451afd968873981879afb433927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a90ed84465ac74a22c7640e620376378a0e0323511eb6461dc6646c824f430f679d79c56ee89937c073fb601d41cb2335cfa5370543da641bce0c91fdcc33463
|
7
|
+
data.tar.gz: 2400cd36dbb04f1b0c915e3f6f6011115be55bdbc55b3035874ef6584514463b9694de7f73c26fe688417cc6fb39aaae64f9df4d5457e32f87b586f0802ecda7
|
@@ -11,6 +11,8 @@ module DiscourseSubscriptionClient
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def authorize
|
14
|
+
session[:final_landing_path] = params[:final_landing_path]
|
15
|
+
|
14
16
|
request_id = DiscourseSubscriptionClient::Authorization.request_id(@supplier.id)
|
15
17
|
cookies[:user_api_request_id] = request_id
|
16
18
|
redirect_to DiscourseSubscriptionClient::Authorization.url(current_user, @supplier, request_id).to_s,
|
@@ -36,7 +38,11 @@ module DiscourseSubscriptionClient
|
|
36
38
|
|
37
39
|
DiscourseSubscriptionClient::Subscriptions.update
|
38
40
|
|
39
|
-
|
41
|
+
if !session[:final_landing_path].blank?
|
42
|
+
redirect_to session[:final_landing_path]
|
43
|
+
else
|
44
|
+
redirect_to "/admin/plugins"
|
45
|
+
end
|
40
46
|
end
|
41
47
|
|
42
48
|
def destroy
|
@@ -35,7 +35,14 @@ module DiscourseSubscriptionClient
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def find_resources
|
38
|
-
find_plugins
|
38
|
+
resources = find_plugins
|
39
|
+
|
40
|
+
resources.each do |r|
|
41
|
+
@resources << {
|
42
|
+
name: r[:name],
|
43
|
+
supplier_url: r[:supplier_url]
|
44
|
+
}
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
def find_suppliers
|
@@ -73,17 +80,19 @@ module DiscourseSubscriptionClient
|
|
73
80
|
end
|
74
81
|
|
75
82
|
def find_plugins
|
83
|
+
plugins = []
|
76
84
|
Dir["#{DiscourseSubscriptionClient.root}/plugins/*/plugin.rb"].sort.each do |path|
|
77
85
|
source = File.read(path)
|
78
86
|
metadata = Plugin::Metadata.parse(source)
|
79
87
|
|
80
88
|
next unless metadata.subscription_url.present?
|
81
89
|
|
82
|
-
|
90
|
+
plugins << {
|
83
91
|
name: metadata.name,
|
84
92
|
supplier_url: ENV["TEST_SUBSCRIPTION_URL"] || metadata.subscription_url
|
85
93
|
}
|
86
94
|
end
|
95
|
+
plugins
|
87
96
|
end
|
88
97
|
|
89
98
|
def valid_supplier_data?(data)
|
@@ -93,12 +102,11 @@ module DiscourseSubscriptionClient
|
|
93
102
|
return false unless data[:products].is_a?(Hash)
|
94
103
|
|
95
104
|
data[:products].all? do |_resource, products|
|
96
|
-
products.is_a?(Array) &&
|
97
|
-
|
98
|
-
|
99
|
-
product.key?(key) && product[key].is_a?(String)
|
100
|
-
end
|
105
|
+
products.is_a?(Array) && products.all? do |product|
|
106
|
+
%i[product_id product_slug].all? do |key|
|
107
|
+
product.key?(key) && product[key].is_a?(String)
|
101
108
|
end
|
109
|
+
end
|
102
110
|
end
|
103
111
|
end
|
104
112
|
end
|
@@ -13,6 +13,8 @@ module DiscourseSubscriptionClient
|
|
13
13
|
def update
|
14
14
|
return unless SiteSetting.subscription_client_enabled
|
15
15
|
|
16
|
+
DiscourseSubscriptionClient::Resources.find_all
|
17
|
+
|
16
18
|
@result = DiscourseSubscriptionClient::Subscriptions::UpdateResult.new
|
17
19
|
|
18
20
|
if @suppliers.blank?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_subscription_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angus McLeod
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -278,7 +278,7 @@ metadata:
|
|
278
278
|
homepage_uri: https://github.com/paviliondev/discourse_subscription_client
|
279
279
|
source_code_uri: https://github.com/paviliondev/discourse_subscription_client
|
280
280
|
changelog_uri: https://github.com/paviliondev/discourse_subscription_client
|
281
|
-
post_install_message:
|
281
|
+
post_install_message:
|
282
282
|
rdoc_options: []
|
283
283
|
require_paths:
|
284
284
|
- lib
|
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
294
|
version: 1.3.1
|
295
295
|
requirements: []
|
296
296
|
rubygems_version: 3.4.6
|
297
|
-
signing_key:
|
297
|
+
signing_key:
|
298
298
|
specification_version: 4
|
299
299
|
summary: Discourse plugin subscription client.
|
300
300
|
test_files: []
|