discourse_subscription_client 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/discourse_subscription_client/suppliers_controller.rb +7 -1
- data/app/models/subscription_client_resource.rb +6 -8
- data/app/serializers/discourse_subscription_client/supplier_serializer.rb +1 -0
- data/lib/discourse_subscription_client/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03fe5f25d9d530751ddc8530ff74fb3bca6eef434172769f621beb0ddaebf8bb
|
4
|
+
data.tar.gz: 39a728c0ffecdbbfb5d4b6b69983b49fa533dd410ccecd72dfb52aa19657d3ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce4bf56aecb3056ecdda3888508088511417f5739334203dc16d0504324bb4acdb8314de6fdc9818cf14942367e26594c4c91d911eec060cc0d2deb2dac0d72b
|
7
|
+
data.tar.gz: c26396551c3dea1b80770918dbc64d4b7ff423e6b0e674ce856c87a46114b11a8ac074cad7631ac47e4cc61350749a34470e925757fea992dba22cfc9623e300
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ RAILS_ENV=test rake db:drop db:create db:migrate
|
|
53
53
|
If you're not adding new migrations you only need to load the schema. If you are running migrations you need to also load the schema (in addition to running the migrations)
|
54
54
|
|
55
55
|
```
|
56
|
-
RAILS_ENV=test rake db:schema:load
|
56
|
+
RAILS_ENV=test bundle exec rake db:schema:load
|
57
57
|
```
|
58
58
|
|
59
59
|
## License
|
@@ -7,7 +7,13 @@ module DiscourseSubscriptionClient
|
|
7
7
|
before_action :find_supplier, only: %i[authorize destroy]
|
8
8
|
|
9
9
|
def index
|
10
|
-
|
10
|
+
suppliers = SubscriptionClientSupplier.all
|
11
|
+
if params[:resource]
|
12
|
+
suppliers = suppliers
|
13
|
+
.joins(:resources)
|
14
|
+
.where(resources: { name: params[:resource] })
|
15
|
+
end
|
16
|
+
render_serialized(suppliers, SupplierSerializer, root: "suppliers")
|
11
17
|
end
|
12
18
|
|
13
19
|
def authorize
|
@@ -8,21 +8,19 @@ class SubscriptionClientResource < ActiveRecord::Base
|
|
8
8
|
has_many :subscriptions, foreign_key: "resource_id", class_name: "SubscriptionClientSubscription", dependent: :destroy
|
9
9
|
|
10
10
|
def get_source_url(bucket)
|
11
|
-
return nil unless access_key_id && secret_access_key
|
11
|
+
return nil unless access_key_id && secret_access_key && s3_client
|
12
12
|
return nil unless can_access_bucket?(bucket)
|
13
13
|
|
14
14
|
"s3://#{access_key_id}:#{secret_access_key}@#{bucket}"
|
15
15
|
end
|
16
16
|
|
17
17
|
def can_access_bucket?(bucket)
|
18
|
-
|
19
|
-
s3_client.head_bucket(bucket: bucket)
|
20
|
-
rescue Aws::S3::Errors::BadRequest,
|
21
|
-
Aws::S3::Errors::Forbidden,
|
22
|
-
Aws::S3::Errors::NotFound => e
|
23
|
-
return false
|
24
|
-
end
|
18
|
+
s3_client.head_bucket(bucket: bucket)
|
25
19
|
true
|
20
|
+
rescue Aws::S3::Errors::BadRequest,
|
21
|
+
Aws::S3::Errors::Forbidden,
|
22
|
+
Aws::S3::Errors::NotFound
|
23
|
+
false
|
26
24
|
end
|
27
25
|
|
28
26
|
def s3_client
|
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.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angus McLeod
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-sdk-s3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: byebug
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,20 +234,6 @@ dependencies:
|
|
220
234
|
- - ">="
|
221
235
|
- !ruby/object:Gem::Version
|
222
236
|
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: aws-sdk-s3
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '0'
|
237
237
|
description: Adds a backend subscription client to a Discourse plugin.
|
238
238
|
email:
|
239
239
|
- angus@mcleod.org.au
|