discourse_subscription_client 0.1.0.pre13 → 0.1.0.pre14

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: 0eb5ae72b353d0c2247634efd915ba4702c6ce9e7edc79a6cd1bfec8ed008d12
4
- data.tar.gz: 7ad730452ccc89cf452571029f3d1f4a4c6844d6bd642d32a63d92ddf3b0250d
3
+ metadata.gz: 07afbdfba495c751b1a4f98c5ab657e5f0e044613e525ed806a438a97d41e994
4
+ data.tar.gz: 790e0abe8336eeb2f53eeb0f49a975d0f2a5a9054b6bc56bee6435d76474c563
5
5
  SHA512:
6
- metadata.gz: 60f355d11aa8199f740908df977e4e7a6e6c54dc2a52f5ed3d0e656672580230bfc30019f5dd6e68b801843a9bb1192e6d9f8938d8753924f474caf02534717c
7
- data.tar.gz: 3de6d7e1ec21a234e8fe1c1a45c53f9db5135327cf4ceda307c262b413a903dcade95796d0268445c34abc2eb03a854da59d0b878e109cada669c63b59db90fc
6
+ metadata.gz: 4d63f530f372e9fe425ca8584ed89b64ae2b95815ee61de495c2b77946b6e379ade75705bb225d6f89433f9ea0fbcd6f643c67dec0f3f7f6f593f23d97aaed6c
7
+ data.tar.gz: 9875787a8a6de21f0fe8d9482f82cd3045dd73a9394e2d6d2ba6d2b3892d569162628b2eed2e5974200aab3ea6e3c9833a00e1f91c9042d643267d1b59d3df22
@@ -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
- @resources << {
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
- products.all? do |product|
98
- %i[product_id product_slug].all? do |key|
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscourseSubscriptionClient
4
- VERSION = "0.1.0.pre13"
4
+ VERSION = "0.1.0.pre14"
5
5
  end
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.pre13
4
+ version: 0.1.0.pre14
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-05-31 00:00:00.000000000 Z
11
+ date: 2023-07-05 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: []