shrine-transloadit 1.0.0 → 1.0.1

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: 19c66daf493f1fe800d44d3264dcc0a5699f1d177322781ac61b81cd928d8922
4
- data.tar.gz: e3a5960f9c9c5db0ed2adfd2299dc7972b23ae635a55951144344135cb1af121
3
+ metadata.gz: 676a7641d40ab1351f8c7f758deffc26b7675c52216f1659ca11eb69c3f95ad1
4
+ data.tar.gz: ed8f9394fda63ba4222d021dca5748eb63f2cd120db63255d7bb4ba2d5dd95d3
5
5
  SHA512:
6
- metadata.gz: 063645f16216fb57eccc422b5fc515ec27c8abc1b47ef75f6dab29db4e017bcce4af08d95cb066aa9cb7632181706243387ddc82eb90bf27b615fe1dfcac0415
7
- data.tar.gz: 04bfb71e941d72369aa91b8d473dc24472991c2b6c63fb99090a2125d9d4123542d98b8e6f3785c100419df91a54342fa4cb1c2e7ec53d484b311fdeb57fa495
6
+ metadata.gz: 5bc45be18e75f362829a81054ac477ccf3b9ddfc1f14f04be3c91153fbb12e55750223ef3fd0c9f2836b5f6cf597c638de2dace1f387e273f6b402713244d26b
7
+ data.tar.gz: c140c37dee50b4540df7121ac5eabf781df4e6b99f69289bc1ddc80659621c1a9bdb063b3583a49cc64e413fa2c64ee230d7ce4b55ff12cbbfdeca2b91be260a
data/README.md CHANGED
@@ -117,10 +117,21 @@ attacher.derivatives #=>
117
117
  When using [backgrounding], it's probably best to create the assembly after
118
118
  promotion:
119
119
 
120
+ ```rb
121
+ Shrine.plugin :backgrounding
122
+ Shrine::Attacher.promote_block do
123
+ PromoteJob.perform_async(self.class.name, record.class.name, record.id, name, file_data)
124
+ end
125
+ ```
120
126
  ```rb
121
127
  class PromoteJob
122
- def perform(record, name, file_data)
123
- attacher = Shrine::Attacher.retrieve(model: record, name: name, file: file_data)
128
+ include Sidekiq::Worker
129
+
130
+ def perform(attacher_class, record_class, record_id, name, file_data)
131
+ attacher_class = Object.const_get(attacher_class)
132
+ record = Object.const_get(record_class).find(record_id) # if using Active Record
133
+
134
+ attacher = attacher_class.retrieve(model: record, name: name, file: file_data)
124
135
  attacher.atomic_promote
125
136
  attacher.transloadit_process
126
137
  # ...
@@ -239,8 +250,13 @@ end
239
250
  ```
240
251
  ```rb
241
252
  class PromoteJob
242
- def perform(record, name, file_data)
243
- attacher = Shrine::Attacher.retrieve(model: record, name: name, file: file_data)
253
+ include Sidekiq::Worker
254
+
255
+ def perform(attacher_class, record_class, record_id, name, file_data)
256
+ attacher_class = Object.const_get(attacher_class)
257
+ record = Object.const_get(record_class).find(record_id) # if using Active Record
258
+
259
+ attacher = attacher_class.retrieve(model: record, name: name, file: file_data)
244
260
 
245
261
  response = attacher.transloadit_process
246
262
  response.reload_until_finished!
@@ -57,25 +57,25 @@ class Shrine
57
57
  end
58
58
 
59
59
  module AttacherMethods
60
- def transloadit_process(name = :default, *args)
60
+ def transloadit_process(name = :default, *args, **kwargs)
61
61
  processor = self.class.transloadit_processor(name)
62
62
  instrument_transloadit(name) do
63
- instance_exec(*args, &processor)
63
+ instance_exec(*args, **kwargs, &processor)
64
64
  end
65
65
  end
66
66
 
67
- def transloadit_save(name = :default, *args)
67
+ def transloadit_save(name = :default, *args, **kwargs)
68
68
  unless name.respond_to?(:to_sym)
69
69
  args.prepend(name)
70
70
  name = :default
71
71
  end
72
72
 
73
73
  saver = self.class.transloadit_saver(name)
74
- instance_exec(*args, &saver)
74
+ instance_exec(*args, **kwargs, &saver)
75
75
  end
76
76
 
77
- def transloadit_step(*args)
78
- shrine_class.transloadit_step(*args)
77
+ def transloadit_step(*args, **kwargs)
78
+ shrine_class.transloadit_step(*args, **kwargs)
79
79
  end
80
80
 
81
81
  def transloadit
@@ -92,7 +92,9 @@ class Shrine
92
92
  end
93
93
 
94
94
  module ClassMethods
95
- def transloadit_step(name, robot, use: nil, **options)
95
+ def transloadit_step(name, robot, **options)
96
+ use = options.delete(:use)
97
+
96
98
  if Array(use).first.is_a?(::Transloadit::Step)
97
99
  step = transloadit.step(name, robot, **options)
98
100
  step.use(use) if use
@@ -198,8 +200,8 @@ class Shrine
198
200
  **options
199
201
  end
200
202
 
201
- def transloadit_step(*args)
202
- self.class.transloadit_step(*args)
203
+ def transloadit_step(*args, **kwargs)
204
+ self.class.transloadit_step(*args, **kwargs)
203
205
  end
204
206
  end
205
207
 
@@ -245,8 +247,8 @@ class Shrine
245
247
  **options
246
248
  end
247
249
 
248
- def transloadit_step(*args)
249
- shrine_class.transloadit_step(*args)
250
+ def transloadit_step(*args, **kwargs)
251
+ shrine_class.transloadit_step(*args, **kwargs)
250
252
  end
251
253
  end
252
254
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-transloadit"
3
- gem.version = "1.0.0"
3
+ gem.version = "1.0.1"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.2"
6
6
 
@@ -13,12 +13,12 @@ Gem::Specification.new do |gem|
13
13
  gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "*.gemspec"]
14
14
  gem.require_path = "lib"
15
15
 
16
- gem.add_dependency "shrine", ">= 3.0.0.beta3", "< 4"
16
+ gem.add_dependency "shrine", "~> 3.0"
17
17
  gem.add_dependency "transloadit", "~> 2.0"
18
18
 
19
19
  gem.add_development_dependency "rake"
20
20
  gem.add_development_dependency "minitest"
21
21
  gem.add_development_dependency "aws-sdk-s3", "~> 1.14"
22
- gem.add_development_dependency "shrine-url"
22
+ gem.add_development_dependency "shrine-url", "~> 2.4"
23
23
  gem.add_development_dependency "dry-monitor"
24
24
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-transloadit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-25 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 3.0.0.beta3
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '4'
19
+ version: '3.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 3.0.0.beta3
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '4'
26
+ version: '3.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: transloadit
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -90,16 +84,16 @@ dependencies:
90
84
  name: shrine-url
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - ">="
87
+ - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: '0'
89
+ version: '2.4'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - ">="
94
+ - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: '0'
96
+ version: '2.4'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: dry-monitor
105
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +108,7 @@ dependencies:
114
108
  - - ">="
115
109
  - !ruby/object:Gem::Version
116
110
  version: '0'
117
- description:
111
+ description:
118
112
  email:
119
113
  - janko.marohnic@gmail.com
120
114
  executables: []
@@ -129,7 +123,7 @@ homepage: https://github.com/shrinerb/shrine-transloadit
129
123
  licenses:
130
124
  - MIT
131
125
  metadata: {}
132
- post_install_message:
126
+ post_install_message:
133
127
  rdoc_options: []
134
128
  require_paths:
135
129
  - lib
@@ -144,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
138
  - !ruby/object:Gem::Version
145
139
  version: '0'
146
140
  requirements: []
147
- rubygems_version: 3.0.3
148
- signing_key:
141
+ rubygems_version: 3.2.15
142
+ signing_key:
149
143
  specification_version: 4
150
144
  summary: Provides Transloadit integration for Shrine.
151
145
  test_files: []