uploadcare-rails 2.0.0 → 2.1.0

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: 350614c535917ec6a0e4967b6c1935520615f7c05f2dde048e2e71049acfb53e
4
- data.tar.gz: d76147a67baf18cf174a28ba1a3f1351ecfae7d2b66efb2dbfa2705ea9ed1f47
3
+ metadata.gz: 38c85ab9fffeaf3eb90a9599987bc47e7b5eaa94f06019839b977d468da240c6
4
+ data.tar.gz: 4eb45615ff72233fe84e4c93376a96ab12dd226747fda06010d035d6be0a3b08
5
5
  SHA512:
6
- metadata.gz: 5c8da1247c066d6e6224d04ab9d38d59fd18aea135e24e927de0c515f32e7a1544952840bb1b11a44f812bf511fb0fe0c2eb0ff891c2aba3d88b899ed8a2cc7c
7
- data.tar.gz: a1974745e61af0f76c8eda6e509db5677f153f6e59ad722463dfd3e1103b3710793eac34a1327e13e10658c0f21e198edf009abfe73898cfbe8cfb748c75e7f3
6
+ metadata.gz: 3056878b541b5bcac2e56a495c2378ac2e77e5ce1c76d0c0c4a1eec7a4228845224b509704d84d3ea0472560bb46c51e3482f9a02d7f6a99d2775b542e42cbf5
7
+ data.tar.gz: 6343fc434e5471be000474256e0178a7bd2ee5acf22adae53e8ff10e9c80a5bc213c9709d7bcfe613ea304275a022a7f61a66f2e0bf8a2882c5c022f9515189c
@@ -19,9 +19,9 @@ module Uploadcare
19
19
 
20
20
  # Create a webhook
21
21
  # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#operation/webhookCreate
22
- def create_webhook(target_url, event: 'file.uploaded', is_active: true)
23
- options = { target_url: target_url, event: event, is_active: is_active }
24
- Uploadcare::Webhook.create(**options)
22
+ def create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil)
23
+ options = { target_url: target_url, event: event, is_active: is_active, signing_secret: signing_secret }
24
+ Uploadcare::Webhook.create(**options.compact)
25
25
  end
26
26
 
27
27
  # Updates a webhook
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Uploadcare
4
4
  module Rails
5
- VERSION = '2.0.0'
5
+ VERSION = '2.1.0'
6
6
  end
7
7
  end
@@ -28,7 +28,10 @@ module Uploadcare
28
28
 
29
29
  it 'creates a webhook', :aggregate_failures do
30
30
  VCR.use_cassette('webhook_api_create_webhook') do
31
- response = subject.create_webhook('https://ucarecdn.com/3542c513-5cf4-4adb-97b0-bfa7fbd31fb5/11.png')
31
+ response = subject.create_webhook(
32
+ 'https://ucarecdn.com/3542c513-5cf4-4adb-97b0-bfa7fbd31fb5/11.png',
33
+ signing_secret: '1234'
34
+ )
32
35
  %w[id created updated event target_url project is_active].each do |key|
33
36
  expect(response).to have_key(key)
34
37
  end
@@ -38,7 +41,12 @@ module Uploadcare
38
41
  it 'updates a webhook', :aggregate_failures do
39
42
  VCR.use_cassette('webhook_api_update_webhook') do
40
43
  new_target_url = 'https://ucarecdn.com/3542c513-5cf4-4adb-97b0-bfa7fbd31fb5/11.png'
41
- response = subject.update_webhook('811134', target_url: new_target_url, is_active: false)
44
+ response = subject.update_webhook(
45
+ '811134',
46
+ target_url: new_target_url,
47
+ is_active: false,
48
+ signing_secret: '1234'
49
+ )
42
50
  expect(response['target_url']).to eq(new_target_url)
43
51
  expect(response['is_active']).to eq(false)
44
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadcare-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@dmitrijivanchenko (Dmitrij Ivanchenko)"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,7 +178,6 @@ files:
178
178
  - spec/spec_helper.rb
179
179
  - spec/support/generators.rb
180
180
  - spec/support/vcr.rb
181
- - spec/tmp/config/initializers/uploadcare.rb
182
181
  - spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb
183
182
  - spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb
184
183
  - spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb
@@ -218,58 +217,57 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
217
  - !ruby/object:Gem::Version
219
218
  version: '0'
220
219
  requirements: []
221
- rubygems_version: 3.2.22
220
+ rubygems_version: 3.0.1
222
221
  signing_key:
223
222
  specification_version: 4
224
223
  summary: Rails gem for Uploadcare
225
224
  test_files:
226
- - spec/fixtures/kitten.jpeg
227
- - spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml
228
- - spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml
229
- - spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml
230
- - spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml
231
- - spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml
232
- - spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml
233
- - spec/fixtures/vcr_cassettes/file_api_copy_file.yml
234
- - spec/fixtures/vcr_cassettes/file_api_delete_file.yml
235
- - spec/fixtures/vcr_cassettes/file_api_delete_files.yml
236
- - spec/fixtures/vcr_cassettes/file_api_get_file.yml
237
- - spec/fixtures/vcr_cassettes/file_api_get_files.yml
238
- - spec/fixtures/vcr_cassettes/file_api_load_file.yml
239
- - spec/fixtures/vcr_cassettes/file_api_store_file.yml
240
- - spec/fixtures/vcr_cassettes/file_api_store_files.yml
241
- - spec/fixtures/vcr_cassettes/group_api_create_group.yml
242
- - spec/fixtures/vcr_cassettes/group_api_get_group.yml
243
- - spec/fixtures/vcr_cassettes/group_api_get_groups.yml
244
- - spec/fixtures/vcr_cassettes/group_api_store_group.yml
245
- - spec/fixtures/vcr_cassettes/project_api_get_project.yml
246
- - spec/fixtures/vcr_cassettes/upload_upload_many_files.yml
247
- - spec/fixtures/vcr_cassettes/upload_upload_one_file.yml
248
- - spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml
249
- - spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml
250
- - spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml
251
- - spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml
252
- - spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml
253
- - spec/generators/uploadcare_config_generator_spec.rb
254
225
  - spec/spec_helper.rb
255
- - spec/support/generators.rb
256
- - spec/support/vcr.rb
257
- - spec/tmp/config/initializers/uploadcare.rb
258
- - spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb
259
- - spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb
260
- - spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb
261
- - spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb
262
- - spec/uploadcare/rails/api/rest/conversion_api_spec.rb
226
+ - spec/generators/uploadcare_config_generator_spec.rb
263
227
  - spec/uploadcare/rails/api/rest/file_api_spec.rb
264
- - spec/uploadcare/rails/api/rest/group_api_spec.rb
265
228
  - spec/uploadcare/rails/api/rest/project_api_spec.rb
266
229
  - spec/uploadcare/rails/api/rest/webhook_api_spec.rb
230
+ - spec/uploadcare/rails/api/rest/group_api_spec.rb
231
+ - spec/uploadcare/rails/api/rest/conversion_api_spec.rb
267
232
  - spec/uploadcare/rails/api/upload/upload_api_spec.rb
233
+ - spec/uploadcare/rails/objects/group_spec.rb
234
+ - spec/uploadcare/rails/objects/file_spec.rb
268
235
  - spec/uploadcare/rails/jobs/delete_file_job_spec.rb
269
236
  - spec/uploadcare/rails/jobs/store_file_job_spec.rb
270
237
  - spec/uploadcare/rails/jobs/store_group_job_spec.rb
271
- - spec/uploadcare/rails/objects/file_spec.rb
272
- - spec/uploadcare/rails/objects/group_spec.rb
273
- - spec/uploadcare/rails/services/id_extractor_spec.rb
274
238
  - spec/uploadcare/rails/transformations/image_transformations_spec.rb
239
+ - spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb
240
+ - spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb
241
+ - spec/uploadcare/rails/services/id_extractor_spec.rb
242
+ - spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb
243
+ - spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb
275
244
  - spec/uploadcare/rails_spec.rb
245
+ - spec/support/generators.rb
246
+ - spec/support/vcr.rb
247
+ - spec/fixtures/vcr_cassettes/group_api_store_group.yml
248
+ - spec/fixtures/vcr_cassettes/file_api_store_file.yml
249
+ - spec/fixtures/vcr_cassettes/upload_upload_many_files.yml
250
+ - spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml
251
+ - spec/fixtures/vcr_cassettes/group_api_get_group.yml
252
+ - spec/fixtures/vcr_cassettes/file_api_delete_file.yml
253
+ - spec/fixtures/vcr_cassettes/file_api_delete_files.yml
254
+ - spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml
255
+ - spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml
256
+ - spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml
257
+ - spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml
258
+ - spec/fixtures/vcr_cassettes/file_api_copy_file.yml
259
+ - spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml
260
+ - spec/fixtures/vcr_cassettes/upload_upload_one_file.yml
261
+ - spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml
262
+ - spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml
263
+ - spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml
264
+ - spec/fixtures/vcr_cassettes/file_api_get_file.yml
265
+ - spec/fixtures/vcr_cassettes/group_api_create_group.yml
266
+ - spec/fixtures/vcr_cassettes/file_api_load_file.yml
267
+ - spec/fixtures/vcr_cassettes/project_api_get_project.yml
268
+ - spec/fixtures/vcr_cassettes/file_api_store_files.yml
269
+ - spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml
270
+ - spec/fixtures/vcr_cassettes/file_api_get_files.yml
271
+ - spec/fixtures/vcr_cassettes/group_api_get_groups.yml
272
+ - spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml
273
+ - spec/fixtures/kitten.jpeg
@@ -1,138 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Uncomment this string in case of using locales for locale_translations parameter
4
- # I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
5
-
6
- Uploadcare::Rails.configure do |config|
7
- # Sets your Uploadcare public key.
8
- config.public_key = ENV.fetch('UPLOADCARE_PUBLIC_KEY', 'demopublickey')
9
- # config.secret_key = ENV.fetch('UPLOADCARE_SECRET_KEY', 'demosecretkey')
10
-
11
- # Stores files to Uploadcare servers after object save.
12
- config.store_files_after_save = true
13
-
14
- # Deletes files from Uploadcare servers after object destroy.
15
- config.delete_files_after_destroy = true
16
-
17
- # Sets caching for Uploadcare files
18
- config.cache_namespace = 'uploadcare'
19
- config.cache_files = true
20
- config.cache_expires_in = 1.day
21
-
22
- # These options enables ActiveJob background jobs to perform operations in background.
23
- # Options work if only the option 'do_not_store' is disabled (false) and
24
- # the option 'delete_files_after_destroy' is enabled (true).
25
- config.store_files_async = true
26
- config.delete_files_async = true
27
-
28
- # If true, only image files are allowed to be uploaded.
29
- # config.images_only = false
30
-
31
- # If true, the preview step is present after selecting files.
32
- # Otherwise, the file uploader dialog closes when the selection is complete.
33
- # config.preview_step = false
34
-
35
- # Defines the file uploader manual crop behavior (see https://uploadcare.com/docs/uploads/file-uploader/#crop-option).
36
- # When uploading images, your users can select a crop area.
37
- # This option does not force your file uploader to accept images only.
38
- # The option also works in the multi-file mode since version 2.3.0.
39
- # config.crop = 'disabled'
40
-
41
- # Saves traffic and storage space by resizing images on a client before uploading.
42
- # See the detailed option description for details. Using the client-side resize does not force the images only option.
43
- # config.image_shrink = '800x600'
44
-
45
- # Allows user to remove uploaded files from the file uploader.
46
- # Please note that those files are not deleted from your account.
47
- # config.clearable = true
48
-
49
- # Allows you to define which upload sources you want to use with the file uploader.
50
- # The value is represented by a space-separated ordered list of upload source names.
51
- # See https://uploadcare.com/docs/uploads/file-uploader/#upload-sources for details.
52
- # config.tabs = %w[url file facebook]
53
-
54
- # Sets the accept attribute for the file uploader dialog.
55
- # If the images only option is disabled, the value is empty.
56
- # Otherwise, the default value is image/*.
57
- # null means accept should be kept empty regardless of the images only value.
58
- # For other possible values, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept
59
- # Note, this is not a replacement for
60
- # our file validation (see https://uploadcare.com/docs/file-uploader-api/file-validation/)
61
- # because your users will still be able to choose any file via drag&drop or from URL.
62
- # config.input_accept_types = %w[image/*]
63
-
64
- # Defines the list of preferred MIME types.
65
- # The list should be ordered and contain space-separated MIME types.
66
- # Common parts can be marked with asterisks: image/* application/vnd.openxmlformats-officedocument.*.
67
- # If no MIME types match the criteria or preferred types are not set, default formats are used.
68
- # Keep in mind that some cloud services can export data in different formats.
69
- # For example, Google document can be exported as Word document, PDF or plain text.
70
- # config.preferred_types = %w[image/* application/vnd.openxmlformats-officedocument.*]
71
-
72
- # Forces a system-native file picking dialog to show up instead of our file uploader.
73
- # That makes the file uploader behavior as close as possible to the generic <input type="file">.
74
- # Native behavior is achieved at the expense of support for uploading content
75
- # from social media and cloud storage, manual crop, and preview step.
76
- # Multi-file selection would still work.
77
- # The option does not work in old browser versions: the dialog falls back to the file uploader.
78
- # config.system_dialog = false
79
-
80
- # This option sets the file size threshold for multipart uploading.
81
- # The value ranges from 10485760 (10 MB), which is default, up to 104857600 (100 MB).
82
- # If a file size hits the threshold, it gets uploaded in four parallel chunks by 5 MB.
83
- # Multipart upload makes large file uploading faster.
84
- # Files go directly to a storage, bypassing our upload servers,
85
- # and they're quickly available for further use. All files below the threshold get uploaded in one piece.
86
- # Note: Multipart upload works with local sources only (files and camera).
87
- # config.multipart_min_size = 10485760
88
-
89
- # Available locales currently are:
90
- # ar az ca cs da de el en es et fr he it ja ko lv nb nl pl pt ro ru sk sr sv tr uk vi zhTW zh
91
- config.locale = 'en'
92
-
93
- # Sets custom localization options. See https://uploadcare.com/docs/uploads/file-uploader/#localization
94
- # config.locale_translations = {}
95
-
96
- # Defines pluralization options. See https://uploadcare.com/docs/uploads/file-uploader/#pluralization
97
- # config.locale_pluralize = {}
98
-
99
- # The option can be used with Authenticated URLs. Defines your proxy backend URL.
100
- # See https://uploadcare.com/docs/security/secure-delivery/#proxy-backend.
101
- # config.preview_proxy = 'https://domain.com/preview?'
102
-
103
- # If true, inputs on your page are initialized automatically, see the article for details -
104
- # https://uploadcare.com/docs/file-uploader-api/widget-initialization/
105
- config.live = true
106
-
107
- # If true, input initialization is invoked manually.
108
- # See https://uploadcare.com/docs/file-uploader-api/widget-initialization/).
109
- config.manual_start = false
110
-
111
- # Defines your schema and CDN domain.
112
- # Can be changed to one of the predefined values (https://uploadcare.com/docs/delivery/cdn/) or your custom CNAME.
113
- # config.cdn_base = 'https://ucarecdn.com/'
114
- config.cdn_hostname = 'ucarecdn.com'
115
-
116
- # Forces files uploaded with a file uploader not to be stored.
117
- # See https://uploadcare.com/docs/uploads/storage/#storing-uploaded-files.
118
- # For instance, you might want to turn this on when automatic file storing is enabled in your project,
119
- # but you do not want to store files uploaded with a particular file uploader.
120
- # config.do_not_store = false
121
-
122
- # Allows you to adjust the quality of an audio recorded via the file uploader Camera Tab.
123
- # Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
124
- # config.audio_bits_per_second = 1
125
-
126
- # Allows you to specify the MIME types.
127
- # The first supported by the browser will be used as an option of
128
- # video stream captured via the file uploader Camera Tab.
129
- # Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
130
- # config.video_preferred_mime_types = []
131
-
132
- # Allows you to adjust the quality of a video stream captured via the file uploader Camera Tab.
133
- # Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
134
- # config.video_bits_per_second = 1
135
-
136
- # Allows you to set the default state of image/video mirorring in the camera tab.
137
- # config.camera_mirror_default = true
138
- end