discourse_subscription_client 0.1.5 → 0.1.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41471a1d6a925dea2dbda3200eb6c0d969c7596fe198add3777e9a667e46ec8c
|
4
|
+
data.tar.gz: e67947bded1babfd33b7f93f74f69aaf7b6202ed7bfef5ca6659a9a2d48c090e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f381d6e4adc9ab55a79279b18e1b9d0d908c993d90795fc192c0fc39731225ab29c854560a96592215c0c0fd0d6d3c791e49b10c8d0a690022f0faf22d098ee
|
7
|
+
data.tar.gz: 27b641921053f1455df6497cd5b770487d11ea53605760816e4e13d51d45f1b992f01463af5a981933e55ae2e124a49dc8b4c6b82d1df14f8a843b0e2976a258
|
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.6
|
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-16 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
|