mobile_workflow 0.7.0 → 0.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 793d6e2517f66a2a0eb664541c4b97a37b5bb8c3a6e55e007b8d0c9947e7dbfc
|
4
|
+
data.tar.gz: 12288b78b8f962f7b99ac47f7f3eaaf8c3390a474672ee943f5ac86123e47f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a5594c34e7dfbfd71dd239aca140018fe9fef0ffcf55b356000450b9e84e9615457c62edc43fe33ebd67b2d3665b02c15ff893079a2e76b387c9811a60bfa9
|
7
|
+
data.tar.gz: 7925c77c229f26fd42b8639038ff74b4f89fa6bfe1a1c7662309f8ae4dce1ca27046bb60e9e5640f5e6360a6b30c2ec666a801048e731213576ab08d3b78d21d
|
@@ -12,13 +12,17 @@ module MobileWorkflow
|
|
12
12
|
|
13
13
|
{
|
14
14
|
"identifier" => binary["identifier"],
|
15
|
-
"url" => presigned_url("#{object.class.name.underscore}/#{object.id}/#{object_attribute}/#{
|
15
|
+
"url" => presigned_url("#{object.class.name.underscore}/#{object.id}/#{object_attribute}/#{s3_object_uuid}.#{extension}"),
|
16
16
|
"method" => "PUT"
|
17
17
|
}
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
|
+
def s3_object_uuid
|
23
|
+
SecureRandom.uuid
|
24
|
+
end
|
25
|
+
|
22
26
|
def presigned_url(key)
|
23
27
|
presigner.presigned_url(:put_object, bucket: ENV['AWS_BUCKET_NAME'], key: key, metadata: {})
|
24
28
|
end
|
@@ -140,9 +140,9 @@ module MobileWorkflow
|
|
140
140
|
return nil unless attachment.attached?
|
141
141
|
|
142
142
|
if attachment.image?
|
143
|
-
Rails.application.routes.url_helpers.rails_representation_url(attachment.variant(options), host:
|
143
|
+
Rails.application.routes.url_helpers.rails_representation_url(attachment.variant(options), host: heroku_attachment_host)
|
144
144
|
elsif attachment.previewable?
|
145
|
-
Rails.application.routes.url_helpers.rails_representation_url(attachment.preview(options), host:
|
145
|
+
Rails.application.routes.url_helpers.rails_representation_url(attachment.preview(options), host: heroku_attachment_host)
|
146
146
|
else
|
147
147
|
return nil
|
148
148
|
end
|
@@ -151,11 +151,13 @@ module MobileWorkflow
|
|
151
151
|
def attachment_url(attachment)
|
152
152
|
return nil unless attachment.attached?
|
153
153
|
|
154
|
-
Rails.application.routes.url_helpers.rails_blob_url(attachment, host:
|
154
|
+
Rails.application.routes.url_helpers.rails_blob_url(attachment, host: heroku_attachment_host)
|
155
155
|
end
|
156
156
|
|
157
|
-
def
|
158
|
-
|
157
|
+
def heroku_attachment_host
|
158
|
+
# TODO: MBS - move this to a configuration property
|
159
|
+
app_name = Rails.env.test? ? 'test' : ENV.fetch('HEROKU_APP_NAME')
|
160
|
+
"https://#{app_name}.herokuapp.com"
|
159
161
|
end
|
160
162
|
end
|
161
163
|
end
|