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: 0d460ed2222706c5a2084f87c0d0543e37ed05fdd77857e7e3e0d6929c93e4a5
4
- data.tar.gz: 7d67f9e17223c4f72f3c0fb3386001ce5d22a4df631f2767eaa594ecd3827867
3
+ metadata.gz: 793d6e2517f66a2a0eb664541c4b97a37b5bb8c3a6e55e007b8d0c9947e7dbfc
4
+ data.tar.gz: 12288b78b8f962f7b99ac47f7f3eaaf8c3390a474672ee943f5ac86123e47f0d
5
5
  SHA512:
6
- metadata.gz: 5108cd81390d9a8663a00c1656ee3de241aa72978168c9142adf2777459251f97c9e9896585c8cfed3eb4bbea356ea1520e2fa5c3fc2f0f6872be1607df4725f
7
- data.tar.gz: c3d124f07540ca2ee3945b86cdb08a461d79d1b80d697ae669c1c724a5bcddcd68cd6600f1834c9646a4609829807e7d2320cf142ddfdfd7383d5c215bbef6ee
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}/#{SecureRandom.uuid}.#{extension}"),
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: attachment_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: attachment_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: attachment_host)
154
+ Rails.application.routes.url_helpers.rails_blob_url(attachment, host: heroku_attachment_host)
155
155
  end
156
156
 
157
- def attachment_host
158
- "https://#{ENV.fetch('HEROKU_APP_NAME')}.herokuapp.com"
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
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.4'
3
3
  RUBY_VERSION = '2.7.3'
4
4
  RAILS_VERSION = '6.1.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith