discourse_subscription_client 0.1.0.pre3 → 0.1.0.pre4

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: 602522458c5663a4de8f0de8d9eeaeb9176ce2f2b029ee81147a6b1080095c86
4
- data.tar.gz: da636f360623adf0b0a9b9a132769f069d78962d9ae4ecc0a8e53afcaaf25d77
3
+ metadata.gz: 307c93dedfd3a85110f7ad12a1d7e6e91bb1aecaaffc7e6025fec54905aa0df7
4
+ data.tar.gz: 11dd2c79ba1d825028cc32d2fabc31b0d889be2cb4d2f3c1ad1664c23025dad0
5
5
  SHA512:
6
- metadata.gz: 2b4ec0d69e8d8d7c0042767047937f3755a456e05063c4325afda1a3ce90985c1bc9bb70583bc043be6803b87a01ece2fd862d917758275c4f31af6b666f7a3a
7
- data.tar.gz: ce5b3d324033770f3fd66f5564fa9387689af99406cfe05d6cab9b97fdbce28d7ffc16ce7fb68dd3fbb09787ac181d8d153bc19b9326a35a1a386f77e4bf7713
6
+ metadata.gz: f22185915974d1abbc65ae2b0ed1b14022eb14ebdf7a9f8d12e03b3a00968d93ec69d39c25ad286149d95cec29e8e5035b4c52f38fbd362720664970f0044472
7
+ data.tar.gz: 6f47325b66b776ac2485989006b7d63f3d6e389f5cf0c53b5c4eb8914d8cb16481dcc05d46eeecada45a9ecd620ca70bd64ea2f502af0d3fcfe09a1760c5cc4e
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jobs
4
- class SubscriptionClientFindResources < ::Jobs::Base
4
+ class DiscourseSubscriptionClientFindResources < ::Jobs::Base
5
5
  def execute(_args = {})
6
6
  ::DiscourseSubscriptionClient::Resources.find_all unless Rails.env.test?
7
7
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jobs
4
- class SubscriptionClientUpdateNotices < ::Jobs::Scheduled
4
+ class DiscourseSubscriptionClientUpdateNotices < ::Jobs::Scheduled
5
5
  every 5.minutes
6
6
 
7
7
  def execute(_args = {})
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jobs
4
- class SubscriptionClientUpdateSubscriptions < ::Jobs::Scheduled
4
+ class DiscourseSubscriptionClientUpdateSubscriptions < ::Jobs::Scheduled
5
5
  every 1.day
6
6
 
7
7
  def execute(_args = {})
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SubscriptionClientNotice < ActiveRecord::Base
4
- belongs_to :notice_subject, polymorphic: true
5
- delegate :name, to: :subject
4
+ belongs_to :notice_subject, polymorphic: true, optional: true
6
5
 
7
6
  scope :warnings, -> { where(notice_type: SubscriptionClientNotice.types[:warning]) }
8
7
  scope :hidden, -> { where("hidden_at IS NOT NULL AND dismissed_at IS NULL AND expired_at IS NULL") }
@@ -5,7 +5,7 @@ class SubscriptionClientSupplier < ActiveRecord::Base
5
5
  has_many :subscriptions, through: :resources
6
6
  has_many :notices, class_name: "SubscriptionClientNotice", as: :notice_subject, dependent: :destroy
7
7
 
8
- belongs_to :user
8
+ belongs_to :user, optional: true
9
9
 
10
10
  scope :authorized, -> { where("api_key IS NOT NULL") }
11
11
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[6.1]
3
+ class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[7.0]
4
4
  def change
5
5
  create_table :subscription_client_suppliers do |t|
6
6
  t.string :name
@@ -12,6 +12,6 @@ class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[6.1]
12
12
  t.timestamps
13
13
  end
14
14
 
15
- add_index :subscription_client_suppliers, [:url], unique: true
15
+ add_index :subscription_client_suppliers, [:url], unique: true, if_not_exists: true
16
16
  end
17
17
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateSubscriptionClientResources < ActiveRecord::Migration[6.1]
3
+ class CreateSubscriptionClientResources < ActiveRecord::Migration[7.0]
4
4
  def change
5
5
  create_table :subscription_client_resources do |t|
6
6
  t.references :supplier, foreign_key: { to_table: :subscription_client_suppliers }
@@ -9,6 +9,6 @@ class CreateSubscriptionClientResources < ActiveRecord::Migration[6.1]
9
9
  t.timestamps
10
10
  end
11
11
 
12
- add_index :subscription_client_resources, %i[supplier_id name], unique: true
12
+ add_index :subscription_client_resources, %i[supplier_id name], unique: true, if_not_exists: true
13
13
  end
14
14
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateSubscriptionClientNotices < ActiveRecord::Migration[6.1]
3
+ class CreateSubscriptionClientNotices < ActiveRecord::Migration[7.0]
4
4
  def change
5
5
  create_table :subscription_client_notices do |t|
6
6
  t.string :title, null: false
@@ -17,6 +17,6 @@ class CreateSubscriptionClientNotices < ActiveRecord::Migration[6.1]
17
17
  end
18
18
 
19
19
  add_index :subscription_client_notices, %i[notice_type notice_subject_type notice_subject_id changed_at],
20
- unique: true, name: "sc_unique_notices"
20
+ unique: true, name: "sc_unique_notices", if_not_exists: true
21
21
  end
22
22
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[6.1]
3
+ class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[7.0]
4
4
  def change
5
5
  create_table :subscription_client_subscriptions do |t|
6
6
  t.references :resource, foreign_key: { to_table: :subscription_client_resources }
@@ -14,6 +14,7 @@ class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[6.1]
14
14
  end
15
15
 
16
16
  add_index :subscription_client_subscriptions, %i[resource_id product_id price_id], unique: true,
17
- name: "sc_unique_subscriptions"
17
+ name: "sc_unique_subscriptions",
18
+ if_not_exists: true
18
19
  end
19
20
  end
@@ -14,7 +14,7 @@ module DiscourseSubscriptionClient
14
14
  config.after_initialize do
15
15
  gem_root = File.expand_path("../..", __dir__)
16
16
 
17
- ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate"
17
+ ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate" unless Rails.env.test?
18
18
 
19
19
  %w[
20
20
  ./request
@@ -35,16 +35,16 @@ module DiscourseSubscriptionClient
35
35
  ../../app/serializers/discourse_subscription_client/resource_serializer
36
36
  ../../app/serializers/discourse_subscription_client/notice_serializer
37
37
  ../../app/serializers/discourse_subscription_client/subscription_serializer
38
- ../../app/jobs/regular/discourse_subscription_client/find_resources
39
- ../../app/jobs/scheduled/discourse_subscription_client/update_subscriptions
40
- ../../app/jobs/scheduled/discourse_subscription_client/update_notices
38
+ ../../app/jobs/regular/discourse_subscription_client_find_resources
39
+ ../../app/jobs/scheduled/discourse_subscription_client_update_subscriptions
40
+ ../../app/jobs/scheduled/discourse_subscription_client_update_notices
41
41
  ../../extensions/discourse_subscription_client/current_user
42
42
  ../../extensions/discourse_subscription_client/guardian
43
43
  ].each do |path|
44
44
  require_relative path
45
45
  end
46
46
 
47
- Jobs.enqueue(:subscription_client_find_resources) if DiscourseSubscriptionClient.database_exists? && !Rails.env.test?
47
+ Jobs.enqueue(:discourse_subscription_client_find_resources) if DiscourseSubscriptionClient.database_exists? && !Rails.env.test?
48
48
 
49
49
  Rails.application.routes.append do
50
50
  mount DiscourseSubscriptionClient::Engine, at: "/admin/plugins/subscription-client"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiscourseSubscriptionClient
4
- VERSION = "0.1.0.pre3"
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_subscription_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre3
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-02-20 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pg
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rails
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +179,7 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: webmock
182
+ name: sprockets-rails
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
@@ -179,7 +193,7 @@ dependencies:
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
- name: pg
196
+ name: webmock
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - ">="
@@ -202,16 +216,15 @@ files:
202
216
  - COPYRIGHT.txt
203
217
  - LICENSE.txt
204
218
  - README.md
205
- - Rakefile
206
219
  - app/assets/config/discourse_subscription_client_manifest.js
207
220
  - app/assets/stylesheets/discourse_subscription_client/application.css
208
221
  - app/controllers/discourse_subscription_client/admin_controller.rb
209
222
  - app/controllers/discourse_subscription_client/notices_controller.rb
210
223
  - app/controllers/discourse_subscription_client/subscriptions_controller.rb
211
224
  - app/controllers/discourse_subscription_client/suppliers_controller.rb
212
- - app/jobs/regular/discourse_subscription_client/find_resources.rb
213
- - app/jobs/scheduled/discourse_subscription_client/update_notices.rb
214
- - app/jobs/scheduled/discourse_subscription_client/update_subscriptions.rb
225
+ - app/jobs/regular/discourse_subscription_client_find_resources.rb
226
+ - app/jobs/scheduled/discourse_subscription_client_update_notices.rb
227
+ - app/jobs/scheduled/discourse_subscription_client_update_subscriptions.rb
215
228
  - app/models/subscription_client_notice.rb
216
229
  - app/models/subscription_client_request.rb
217
230
  - app/models/subscription_client_resource.rb
@@ -224,11 +237,11 @@ files:
224
237
  - config/locales/server.en.yml
225
238
  - config/routes.rb
226
239
  - config/settings.yml
227
- - db/migrate/20220318160955_create_subscription_client_suppliers.rb
228
- - db/migrate/20220318181029_create_subscription_client_resources.rb
229
- - db/migrate/20220318181054_create_subscription_client_notices.rb
230
- - db/migrate/20220318181140_create_subscription_client_subscriptions.rb
231
- - db/migrate/20230220130259_create_subscription_client_requests.rb
240
+ - db/migrate/20230221100514_create_subscription_client_suppliers.rb
241
+ - db/migrate/20230221100524_create_subscription_client_resources.rb
242
+ - db/migrate/20230221100529_create_subscription_client_notices.rb
243
+ - db/migrate/20230221100535_create_subscription_client_subscriptions.rb
244
+ - db/migrate/20230221100540_create_subscription_client_requests.rb
232
245
  - extensions/discourse_subscription_client/current_user.rb
233
246
  - extensions/discourse_subscription_client/guardian.rb
234
247
  - lib/discourse_subscription_client.rb
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/setup"
4
-
5
- APP_RAKEFILE = File.expand_path("spec/support/discourse/Rakefile", __dir__)
6
- load "rails/tasks/engine.rake"
7
-
8
- load "rails/tasks/statistics.rake"
9
-
10
- require "bundler/gem_tasks"