discourse_subscription_client 0.1.0.pre7 → 0.1.0.pre9

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: 0dbf2bec6a47be892f9c6d5adea08819c4fa26b604108e1ea6b2885b94993416
4
- data.tar.gz: 78bd74904236a78a94494481098f93a257dad5d9762f00866ece57b0a09258f9
3
+ metadata.gz: 660696bcefd9a3277aecb58ea84b3b8523fe25f67ce8622537659c3f4e9cb3de
4
+ data.tar.gz: b0a5bb0ef2b75129c5b0698b4ea966452db15e70233edf5e171f52ebc2d76ef7
5
5
  SHA512:
6
- metadata.gz: 8623d169bc5487f16bd3ffbd9e7f6f1b1573dbe3efc7d4353b6e59b5d465ed5fc65d0786b19be06cca045dce5bd52f8536cae266d7c9ae59949400ec87c397bd
7
- data.tar.gz: 6ccfa6917ddf19f82884a6c769b43670719c55a181a95ef5b690b8077f80c2ebed8225930aac0e450c788f22a7d53604f3dcb4ab2c676fcb7518537423c014ce
6
+ metadata.gz: 601eed6e1e0d001609fd9f3f1c9ffc4c5db1dbaea3f892c00542794f1a659739afd32b68b4e70fb603ec25c2c662f32112928617f7f1bcbd8eebba0d68059ab2
7
+ data.tar.gz: dfcef63df0719f54187dcdb0530c5f154b6e2750ebe2583b1ea260a8acafb6fc71d982e2512b16b0416780d961556a751e5eac783660c7527f5feac72290b12a
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DiscourseSubscriptionClient
4
+ class FindResources < ::Jobs::Base
5
+ def execute(_args = {})
6
+ Resources.find_all unless Rails.env.test?
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DiscourseSubscriptionClient
4
+ class UpdateNotices < ::Jobs::Scheduled
5
+ every 5.minutes
6
+
7
+ def execute(_args = {})
8
+ Notices.update
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DiscourseSubscriptionClient
4
+ class UpdateSubscriptions < ::Jobs::Scheduled
5
+ every 1.day
6
+
7
+ def execute(_args = {})
8
+ Subscriptions.update
9
+ end
10
+ end
11
+ end
@@ -9,7 +9,7 @@ module DiscourseSubscriptionClient
9
9
 
10
10
  config.before_initialize do
11
11
  config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
12
- Rails.autoloaders.main.ignore(config.root) if defined?(Rails) == 'constant'
12
+ Rails.autoloaders.main.ignore(config.root) if defined?(Rails) == "constant"
13
13
  end
14
14
 
15
15
  config.after_initialize do
@@ -37,9 +37,9 @@ module DiscourseSubscriptionClient
37
37
  ../../app/serializers/discourse_subscription_client/resource_serializer
38
38
  ../../app/serializers/discourse_subscription_client/notice_serializer
39
39
  ../../app/serializers/discourse_subscription_client/subscription_serializer
40
- ../../app/jobs/discourse_subscription_client_find_resources
41
- ../../app/jobs/discourse_subscription_client_update_subscriptions
42
- ../../app/jobs/discourse_subscription_client_update_notices
40
+ ../../app/jobs/discourse_subscription_client/find_resources
41
+ ../../app/jobs/discourse_subscription_client/update_subscriptions
42
+ ../../app/jobs/discourse_subscription_client/update_notices
43
43
  ../../extensions/discourse_subscription_client/current_user_serializer
44
44
  ../../extensions/discourse_subscription_client/site_serializer
45
45
  ../../extensions/discourse_subscription_client/guardian
@@ -47,7 +47,7 @@ module DiscourseSubscriptionClient
47
47
  require_relative path
48
48
  end
49
49
 
50
- Jobs.enqueue(:discourse_subscription_client_find_resources) if !Rails.env.test? && DiscourseSubscriptionClient.database_exists?
50
+ Jobs.enqueue(DiscourseSubscriptionClient::FindResources) if !Rails.env.test? && DiscourseSubscriptionClient.database_exists?
51
51
 
52
52
  Rails.application.routes.append do
53
53
  mount DiscourseSubscriptionClient::Engine, at: "/admin/plugins/subscription-client"
@@ -95,6 +95,7 @@ module DiscourseSubscriptionClient
95
95
  end
96
96
 
97
97
  def valid_supplier_data?(data)
98
+ return false unless data.present? && data.is_a?(Hash)
98
99
  return false unless %i[supplier products].all? { |key| data.key?(key) }
99
100
  return false unless data[:supplier].is_a?(String)
100
101
  return false unless data[:products].is_a?(Array)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscourseSubscriptionClient
4
- VERSION = "0.1.0.pre7"
4
+ VERSION = "0.1.0.pre9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse_subscription_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre7
4
+ version: 0.1.0.pre9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod
@@ -236,9 +236,9 @@ files:
236
236
  - app/controllers/discourse_subscription_client/notices_controller.rb
237
237
  - app/controllers/discourse_subscription_client/subscriptions_controller.rb
238
238
  - app/controllers/discourse_subscription_client/suppliers_controller.rb
239
- - app/jobs/discourse_subscription_client_find_resources.rb
240
- - app/jobs/discourse_subscription_client_update_notices.rb
241
- - app/jobs/discourse_subscription_client_update_subscriptions.rb
239
+ - app/jobs/discourse_subscription_client/find_resources.rb
240
+ - app/jobs/discourse_subscription_client/update_notices.rb
241
+ - app/jobs/discourse_subscription_client/update_subscriptions.rb
242
242
  - app/models/subscription_client_notice.rb
243
243
  - app/models/subscription_client_request.rb
244
244
  - app/models/subscription_client_resource.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jobs
4
- class DiscourseSubscriptionClientFindResources < ::Jobs::Base
5
- def execute(_args = {})
6
- ::DiscourseSubscriptionClient::Resources.find_all unless Rails.env.test?
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jobs
4
- class DiscourseSubscriptionClientUpdateNotices < ::Jobs::Scheduled
5
- every 5.minutes
6
-
7
- def execute(_args = {})
8
- ::DiscourseSubscriptionClient::Notices.update
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jobs
4
- class DiscourseSubscriptionClientUpdateSubscriptions < ::Jobs::Scheduled
5
- every 1.day
6
-
7
- def execute(_args = {})
8
- ::DiscourseSubscriptionClient::Subscriptions.update
9
- end
10
- end
11
- end