discourse_subscription_client 0.1.0.pre9 → 0.1.0.pre11
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 +4 -4
- data/README.md +1 -1
- data/app/controllers/discourse_subscription_client/no_access_controller.rb +9 -0
- data/app/models/subscription_client_supplier.rb +9 -9
- data/config/routes.rb +2 -0
- data/lib/discourse_subscription_client/engine.rb +1 -0
- data/lib/discourse_subscription_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6182382e0517359b04736dd702fc121669e40775a138eaf6bab7493ae722591a
|
4
|
+
data.tar.gz: 4554111e5f4b3659cfbf5d1ac70bed551237435e32c5265acf8a8093ca7db5d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2988268b14449153a71e2345489f8cc97861b1d6562d62901724ba0db2151465a58bc153bffad9d5a516e2218cfd761523a0d95d8ca90a3e0c24351c1f21365b
|
7
|
+
data.tar.gz: e7d340f95ce7995c7edb4444987daec675706e056898613a2b7526af5010d5a239249e764d4e7804a0e3c75ac1ae0f16386c03e9c691d72ce0ff0f96bfeb45d1
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ This gem is only for use with Discourse plugins. It provides subscription client
|
|
5
5
|
Add this line to your plugin's `plugin.rb` file
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem "discourse_subscription_client", "0.1.0.
|
8
|
+
gem "discourse_subscription_client", "0.1.0.pre11", require_name: "discourse_subscription_client"
|
9
9
|
```
|
10
10
|
|
11
11
|
## Usage
|
@@ -10,13 +10,9 @@ class SubscriptionClientSupplier < ActiveRecord::Base
|
|
10
10
|
scope :authorized, -> { where("api_key IS NOT NULL") }
|
11
11
|
|
12
12
|
def destroy_authorization
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
true
|
17
|
-
else
|
18
|
-
false
|
19
|
-
end
|
13
|
+
DiscourseSubscriptionClient::Authorization.revoke(self)
|
14
|
+
update(api_key: nil, user_id: nil, authorized_at: nil)
|
15
|
+
deactivate_all_subscriptions!
|
20
16
|
end
|
21
17
|
|
22
18
|
def authorized?
|
@@ -24,8 +20,12 @@ class SubscriptionClientSupplier < ActiveRecord::Base
|
|
24
20
|
end
|
25
21
|
|
26
22
|
def product_slugs
|
27
|
-
|
28
|
-
|
23
|
+
if products.present?
|
24
|
+
products.each_with_object({}) do |product, result|
|
25
|
+
result[product["product_id"]] = product["product_slug"]
|
26
|
+
end
|
27
|
+
else
|
28
|
+
{}
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/config/routes.rb
CHANGED
@@ -29,6 +29,7 @@ module DiscourseSubscriptionClient
|
|
29
29
|
../../app/models/subscription_client_resource
|
30
30
|
../../app/models/subscription_client_subscription
|
31
31
|
../../app/models/subscription_client_supplier
|
32
|
+
../../app/controllers/discourse_subscription_client/no_access_controller
|
32
33
|
../../app/controllers/discourse_subscription_client/admin_controller
|
33
34
|
../../app/controllers/discourse_subscription_client/subscriptions_controller
|
34
35
|
../../app/controllers/discourse_subscription_client/suppliers_controller
|
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.pre11
|
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-
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- app/assets/config/discourse_subscription_client_manifest.js
|
234
234
|
- app/assets/stylesheets/discourse_subscription_client/application.css
|
235
235
|
- app/controllers/discourse_subscription_client/admin_controller.rb
|
236
|
+
- app/controllers/discourse_subscription_client/no_access_controller.rb
|
236
237
|
- app/controllers/discourse_subscription_client/notices_controller.rb
|
237
238
|
- app/controllers/discourse_subscription_client/subscriptions_controller.rb
|
238
239
|
- app/controllers/discourse_subscription_client/suppliers_controller.rb
|